Skip to main content

Reconnect Strategy

WebSocket clients must assume that disconnects happen. Correct recovery is more important than a long-lived connection.

Reconnect loop

Use exponential backoff with jitter:

AttemptDelay
1250 ms
2500 ms
31 s
42 s
5+Cap at 5 s with jitter

Respect server-provided retry guidance on rate limits or maintenance windows.

Public stream recovery

For market data:

  1. Stop applying deltas when a gap is detected.
  2. Fetch a fresh REST snapshot.
  3. Re-subscribe to the stream.
  4. Apply only messages newer than the snapshot sequence.
  5. Resume normal processing after continuity is restored.

Private stream recovery

For account streams:

  1. Re-authenticate.
  2. Provide the last processed account sequence if supported by the credential tier.
  3. Fetch account state through HTTP as the source of truth.
  4. Reconcile fills, balances, positions, and open orders.
  5. Resume stream processing only after reconciliation.

Cancel-on-disconnect

Market makers can configure cancel-on-disconnect through the Market Maker API. That flow is separate from normal WebSocket reconnect and is designed to remove stale quotes when a strategy loses liveness.

See Market Maker API.