MCPcopy
hub / github.com/tldraw/tldraw / sendConnectMessage

Method sendConnectMessage

packages/sync-core/src/lib/TLSyncClient.ts:647–661  ·  view source on GitHub ↗

* This is the first message that is sent over a newly established socket connection. And we need * to wait for the response before this client can be used.

()

Source from the content-addressed store, hash-verified

645 * to wait for the response before this client can be used.
646 */
647 private sendConnectMessage() {
648 if (this.isConnectedToRoom) {
649 console.error('sendConnectMessage called while already connected')
650 return
651 }
652 this.debug('sending connect message')
653 this.latestConnectRequestId = uniqueId()
654 this.socket.sendMessage({
655 type: 'connect',
656 connectRequestId: this.latestConnectRequestId,
657 schema: this.store.schema.serialize(),
658 protocolVersion: getTlsyncProtocolVersion(),
659 lastServerClock: this.lastServerClock,
660 })
661 }
662
663 /** Switch to offline mode */
664 private resetConnection(hard = false) {

Callers 1

constructorMethod · 0.95

Calls 6

debugMethod · 0.95
uniqueIdFunction · 0.90
getTlsyncProtocolVersionFunction · 0.90
errorMethod · 0.65
sendMessageMethod · 0.65
serializeMethod · 0.45

Tested by

no test coverage detected