js-bao-wss-client / DocumentSyncStateChangedEvent
Interface: DocumentSyncStateChangedEvent
Payload of the documentSyncStateChanged event (client.on("documentSyncStateChanged", ...)). Fired when a remote update for an open document is applied to it, reporting state: "synced" — so a loader that needs to reload on every remote write can subscribe here instead of observing the underlying document directly.
It also fires with state: "error" when an open document cannot be kept in sync:
- a remote update for it arrives but cannot be fetched or applied, which leaves the document behind the server;
- its sync handshake goes unanswered for the whole handshake budget (
sync.handshakeTimeoutMs, default 10s), so what the app is rendering has stopped converging. The client keeps retrying underneath, at a backoff that caps at 15s, and repeats"error"on each timeout it hits. Once such a document does sync, the event fires"synced"once more so the app can clear whatever it surfaced — but not for a completion that only scheduled a stale-local-state reset, since that document still has no server state.
It does not fire at all for updates addressed to a document this client does not have open.
state also carries "syncing" and "stale" for cross-client compatibility; this client emits only "synced" and "error". For a document's overall caught-up/behind state, use the sync event (SyncEvent), which fires on both transitions.
Properties
documentId
documentId:
string
state
state:
"error"|"syncing"|"synced"|"stale"