Skip to main content
A connection runs from the WELCOME frame the server sends on connect to the GOODBYE it sends just before closing. This page covers everything that happens at the connection level, independent of any individual subscription.

WELCOME

Immediately after the upgrade succeeds, the server sends a WELCOME frame:
Treat WELCOME as the signal that the connection is ready: wait for it before sending your first SUBSCRIBE.

Connection limits

The welcome.limits object reports the caps for your connection: Scaling past the subscription cap is by design: open multiple connections. Spread your markets across connections; one API key authenticates all of them, up to your maxConnections. The defaults give one account up to 20 × 200 = 4,000 simultaneous (market, channel) subscriptions. If you need more, reach out and we can raise your account’s connection limit. Dropped or unresponsive connections are cleaned up automatically within about 90 seconds and stop counting against maxConnections. Three further limits bound what a connection may send. A SUBSCRIBE frame may name at most maxSubscriptionsPerConnection markets; a larger frame is refused whole with QUOTA_EXCEEDED and nothing in it is subscribed. Control frames (SUBSCRIBE, UNSUBSCRIBE, LIST, PING) are accepted at 10 per second with a burst of 20; past that, a frame is answered with QUOTA_EXCEEDED and the socket stays open. An inbound frame larger than 64 KiB is refused at the protocol layer and the connection closes with code 1009; a 200-market subscribe is well under that.

Keepalive

The server sends WebSocket-protocol pings every 30 seconds; any standard WebSocket client answers them automatically. A connection that stops answering is treated as idle and closed with IDLE_TIMEOUT. You can also send an application-level PING and get a PONG back, useful as an explicit liveness check or to keep an otherwise-quiet connection active:
The requestId you send is echoed on the PONG. This is independent of the WebSocket-protocol pings above.

Connection lifetime and GOODBYE

Just before the server closes a connection, it sends a GOODBYE frame with a reason, then closes the socket. Reconnect on a GOODBYE or any unexpected close, except AUTH_REVOKED and KICKED.

Reconnect guidance

  • Reconnect with backoff on any close, but reconnect immediately (after a short jitter) on TTL and SHUTDOWN. Those are routine.
  • A 503 during the upgrade means the gateway is at capacity. Back off briefly and retry; you’ll be routed to fresh capacity.
  • A 429 during the upgrade means your account is at its maxConnections limit. Retrying does not help. Close a connection you no longer need (or wait ~90 seconds after an ungraceful drop for its slot to free), and contact us if you need the limit raised.
  • On reconnect, re-SUBSCRIBE to your markets. Each book subscription replays a fresh SNAPSHOT, so your state rebuilds automatically. There is no resume-from-offset to manage.
  • Don’t reconnect on AUTH_REVOKED; the key is dead.