Skip to main content
Everything the client surfaces splits into two kinds: server frames, keyed by the frame’s type, and lifecycle events, connection-level signals the client raises itself. How you receive them is the one place the two SDKs differ in shape.
In TypeScript, on returns an unsubscribe function. Call it to remove that handler:
In Python there is nothing to remove: stop handling a frame type by not branching on it. Frames you never match are discarded when the loop moves on.

Server frames

Every frame carries type, a v version, and a server timestamp (serverTimestamp in TypeScript, server_timestamp in Python). The table lists the additional fields you’ll use most; the WebSocket API’s Message catalog documents each frame in full. Field names are camelCase on the wire and in TypeScript, and snake_case on the Python models: subscriptionId is subscription_id, snapshotPending is snapshot_pending. 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 subscription id yet); the client prunes that market so it won’t be retried on reconnect. That pruning is by market, not by code, so a market refused with MARKET_NOT_YET_OPEN is dropped from the resubscribe set too: the client will not pick it up on its own once the book opens, and you subscribe again when the event is close to starting. 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 are distinct from the server’s ERROR and GOODBYE frames, and the two SDKs expose a different set. TypeScript raises five through the same on surface: Python takes three callbacks on the constructor, because a lifecycle event describes the connection rather than the market and so does not belong in a stream of market frames:
Python has no OPEN, CLOSE or SOCKET_ERROR equivalent. A socket that closes and reconnects is reported through on_reconnecting; one that will not come back ends the iteration, and on_terminated says why. Python also reports a terminal failure by raising from the loop, so a try/except around async for catches what on_terminated reports:
See Reconnection & lifecycle for exactly when a reconnect is scheduled versus given up on.