@mocanvas/sync · type

SyncMessage

type SyncMessage<R extends UnknownRecord = UnknownRecord> = HelloMessage | SnapshotMessage<R> | DiffMessage<R> | PresenceMessage<R> | ByeMessage | UnsupportedMessage

Every message is one JSON object with a type discriminator and a version, which encodeMessage stamps on and decodeMessage checks.

`` hello a client joined; existing peers answer with a snapshot snapshot the document-scope records plus the sender's CRDT stamps diff one squashed store diff, stamped field by field presence one presence record (cursor, camera, selection) bye the client is leaving; drop its presence unsupported synthesised locally for a peer on another protocol version ``

mocanvas is built by Symbio. Free for non-commercial, non-profit and development use; commercial use needs an agreement. Not affiliated with or endorsed by tldraw.