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 stream 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 a minute and stop counting against maxConnections.

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 idleTimeout. 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. Always reconnect on a goodbye or any unexpected close.

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 authRevoked; the key is dead.