Peer sync¶
The sync manager (ConsensusCore) connects a game document to the core-owned
SyncTransport port.
On a local state change it calls generateSyncMessage() and sends raw
Automerge bytes. The transport owns the versioned V1 wire envelope and
normalizes its payload to Uint8Array; the core never parses JSON, base64,
MessagePack, or sender IDs.
The relay-assisted path is therefore not server-authoritative:
Engine → game document → sync manager → transport → peer game document
Every active peer is scheduled for valid local or inbound changes. Sync state
is keyed by the exact opaque peer reference, is removed on close, and a
reconnect receives a fresh reference. net:message remains an application
message event only; it is not a sync path.
Relay peer IDs are connection-scoped identifiers. They can change after a reconnect and are not durable authenticated identities. Establish a separate identity and authentication scheme when that distinction matters.