@mocanvas/sync · function

decodeMessage

declare function decodeMessage<R extends UnknownRecord = UnknownRecord>(data: unknown): SyncMessage<R> | null

Parse a message off the wire. Returns null for anything malformed and an unsupported message for a peer on another protocol version: neither can crash this client, and neither is ever mistaken for a message we understand.

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.