Skip to main content
Every client → server message uses the same envelope on both gateways:
  • id — client-side correlation id; echoed in the response.
  • cmd — one of subscribe / update_subscription / unsubscribe / list_subscriptions / get_book_snapshot / ping.
  • params — command-specific payload (omitted for ping and list_subscriptions).
Every accepted subscription gets a connection-local sid (numeric). Use sid for subsequent updates / unsubscribes and to route incoming events. sids are not stable across reconnects.

subscribe

On /ws/user:
On /ws/market:
Response (market gateway, with a bad tokenId rejected):

Normalization rules

  • All addresses lowercased.
  • tokenId is decimal-string with no leading zeroes.
  • conditionId is lowercased 32-byte hex.
  • Duplicate ids removed.

Rejection codes


update_subscription

Modify the id list of an existing id-based subscription instead of opening a new one. Not allowed on subscription-less channels (user_orders, user_fills).

Add ids

Remove ids

Response (server returns the resulting full id set):
update_subscription on a subscription-less channel is rejected with invalid_params.

get_book_snapshot

Force a fresh full-depth book_snapshot on a token_book subscription without unsubscribing / resubscribing. Use on a sequence gap (book_delta.prevSeq != lastSeq) or after a long pause. By sid:
By token ids (server resolves to the matching subscription):
Response is one book_snapshot per resolved subscription, OR one book_snapshot_failed per token if the snapshot fetch couldn’t complete:

unsubscribe

Unknown sids are silently ignored (idempotent — the response only lists sids that were actually removed).

list_subscriptions

Useful after a reconnect to confirm what the server thinks you’re subscribed to before rebuilding state.

ping

ts is the server clock in milliseconds — clients can use it as a clock-skew probe. There is no application-level idle timeout, but production clients should still send a ping every 20–30 s to defeat intermediate proxies / load balancers that close idle TCP connections.