id— client-side correlation id; echoed in the response.cmd— one ofsubscribe/update_subscription/unsubscribe/list_subscriptions/get_book_snapshot/ping.params— command-specific payload (omitted forpingandlist_subscriptions).
sid (numeric).
Use sid for subsequent updates / unsubscribes and to route incoming
events. sids are not stable across reconnects.
subscribe
On /ws/user:
/ws/market:
Normalization rules
- All addresses lowercased.
tokenIdis decimal-string with no leading zeroes.conditionIdis lowercased 32-byte hex.- Duplicate ids removed.
Rejection codes
Generation 2: a
vault_positions / vault_activity id may be any vault in the greeting’s vaultAddresses. See WebSocket.update_subscription
Modify the id list of an existing id-based subscription instead of
opening a new one. Not allowed on channels whose subscription has no
id list (user_orders, user_fills, user_activity, notifications,
dispute_intent, bond_payout_credited, me_limits_invalidated,
user_compliance_invalidated, the all_* channels and
global_activity): the command is answered with
invalid_params ("<channel> does not support id updates").
Add ids
Remove ids
update_subscription leaves the subscription unchanged and
answers with an error frame, not a rejected[] list:
invalid_params for a malformed request, a
subscription-less channel or a malformed id, forbidden for a vault id
that is not this socket’s vault, not_found for an unknown sid
(sid and channel checks run before ids bounds),
duplicate_subscription when another subscription on the connection
already has the resulting shape, market_unavailable when add_ids names
a market hidden by the
market liquidity gate,
and subscription_too_many_ids when
add_ids passes a raw ids array of more than 100 entries or the
deduplicated resulting set would exceed 100, or when remove_ids
passes a raw ids array of more than current.ids.length + 100
entries (RND-2430). Error frames also carry a trace_id when one is
available.
get_book_snapshot
Force a fresh book_snapshot without unsubscribing /
resubscribing. Use on a sequence gap (book_delta data.prevSeq
differs from the last seq you applied) or after a long pause.
By sid (every token on that token_book subscription; add ids to
refresh only some of them):
sid:
sid is
echoed only when you passed one):
book_snapshot per token id, or a
book_snapshot_failed for a token whose snapshot couldn’t be fetched.
Snapshots requested by ids alone carry no sid.
retryable is always true — back off and send the command again.
subscriptionActive is true when the request carried a sid (that
subscription stays in place and keeps streaming) and false for a
request by ids alone.
A sid that isn’t a token_book subscription is rejected with
invalid_params; an unknown sid with not_found; a request with
neither sid nor an ids array with invalid_params
("ids array is required"); and a raw ids array of more than 100
entries (RND-2430, checked after sid/channel validation and before
per-id parsing) with subscription_too_many_ids ("subscription accepts at most 100 ids").
unsubscribe
sids are silently ignored (idempotent — the response only
lists sids that were actually removed).
list_subscriptions
ping
ts is the server clock in milliseconds — clients can use it as a
clock-skew probe.
The server enforces an idle timeout (60 s by default). It sends a
WebSocket protocol-level ping every half window (30 s by default) and
drops, without a close frame, any connection that has neither answered
with a protocol pong nor sent a message since the previous ping.
Browsers and the common WebSocket libraries answer protocol pings
automatically. Production clients should still send a ping command
every 20–30 s: any client message counts as activity, and it also keeps
intermediate proxies / load balancers from closing an idle TCP
connection.