Skip to main content
Everything the client surfaces flows through on(type, handler). There are two kinds of event: server frames (keyed by the frame’s type) and lifecycle events (connection-level signals the client raises itself). The handler payload is typed per event — on("snapshot", …) gives you a SnapshotFrame, on("reconnecting", …) gives you { attempt, delayMs }.
on returns an unsubscribe function — call it to remove that handler:

Server frames

Every frame carries type, a v version, and a serverTimestamp. The table lists the additional fields you’ll use most; the WebSocket API’s Message catalog documents each frame in full. A few notes:
  • snapshot / delta are the orderbook. Apply the snapshot first, then each delta (a change with size: 0 deletes that price level). seq is a per-subscription monotonic counter for detecting gaps — see Orderbook channel.
  • status reports live, resyncing, closed, unsupported, or unavailable. When the server retires a subscription (closed/unsupported) the client drops it from its resubscribe set so it isn’t replayed on reconnect.
  • error frames raised during subscription creation carry the market and channel that failed (there’s no subscriptionId yet); the client prunes that market so it won’t be retried on reconnect. See Errors for the code values.
  • goodbye precedes a close. Some reasons are terminal — see Reconnection & lifecycle.

Lifecycle events

These are raised by the client, not sent by the server. They’re distinct from the server’s error and goodbye frames.
See Reconnection & lifecycle for exactly when reconnecting versus terminated fires.