WS Reference
Common Requests
Available on every connection: ping, subscribe, and unsubscribe, plus the connection shutdown notice.
WSS
Prefer the application-level
ping message over WebSocket control frames when validating connectivity. Because it is handled as a normal data message, it confirms end-to-end reachability across the same path used by your subscriptions and requests. Control frames are processed separately by WebSocket infrastructure and can still succeed when application data is not flowing reliably.Supported Streams
optionsAccountSummary is account-wide — any contract filter on the request is ignored for it. Note that emitOptionsAccountSummary returns the current snapshot and does not subscribe you: without an active optionsAccountSummary subscription its response never reaches you.Subscribe / Unsubscribe Behavior
- Streams can be requested at connect with the
subscriptionsquery parameter, or added and removed afterwards withsubscribeandunsubscribe - Subscriptions are scoped by product: only options streams can be subscribed on a
product=optionsconnection — a perpetuals stream name is rejected withwrong_product_subscriptions - Requests are all-or-nothing: a single unrecognized stream name rejects the whole request with
invalid_subscriptions, and none of the listed streams are subscribed or unsubscribed - Subscriptions are tracked per stream and market: re-subscribing a stream for a market it is already active on, or unsubscribing it from a market it is not, is a no-op
- Subscribing a stream to a second market adds to it — it does not replace the first;
market: ALLsupersedes every specific market for that stream - Other subscriptions remain unaffected
- Changes apply immediately
- Safe to call repeatedly (idempotent)
- Does not affect other connections
- Does not require reconnecting
market in a subscribe composes with expiration, strike, and type into a contract filter exactly as described in Contract Filter, and defaults to the connection’s own filter when all four are omitted.
Multiple Markets
market is always a single string, never an array — to follow a stream on several markets, send one subscribe per market:
market: ALL supersedes every specific market it was active on, dropping them. Afterwards, subscribing that stream to a specific market is a no-op — the wildcard already covers it.
Unsubscribe Market Selection
Anunsubscribe removes the listed streams for one market or for every market they are active on — the composed contract filter must match the one the stream was subscribed with. market selects what is removed:
On failure the
resultType is subscribe / unsubscribe — not subscribed / unsubscribed, which confirm success only.Connection Shutdown
A connection may receive an unpromptedconnectionShutdown message, carrying the deadline by which it must be re-established.
Reconnect at any point before the deadline. The existing connection stays fully active and keeps delivering messages until it elapses, so opening the new connection first and dropping the old one once it is subscribed avoids any gap in coverage. Read forceCloseInMs from the message rather than assuming a fixed value.
A connection still open when the deadline passes is closed with WebSocket close code 1012, and messages published between that point and your reconnect are missed. Supplying a sessionId recovers missed order events on the reconnect; see WebSocket Session.