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:
| Attempt | Delay |
|---|---|
| 1 | 250 ms |
| 2 | 500 ms |
| 3 | 1 s |
| 4 | 2 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:
- Stop applying deltas when a gap is detected.
- Fetch a fresh REST snapshot.
- Re-subscribe to the stream.
- Apply only messages newer than the snapshot sequence.
- Resume normal processing after continuity is restored.
Private stream recovery
For account streams:
- Re-authenticate.
- Provide the last processed account sequence if supported by the credential tier.
- Fetch account state through HTTP as the source of truth.
- Reconcile fills, balances, positions, and open orders.
- 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.