Skip to main content
Use WebSocket events as invalidation hints. REST remains the source of truth.

Authentication and renewal

  1. Request a ticket from GET /auth/ws-ticket with a browser session or ss_... API token.
  2. Open the socket and send authenticate within five seconds.
  3. Subscribe only after authentication succeeds.
  4. Request and send a new ticket before the 60-second ticket expires.
The socket accepts only WebSocket tickets. It rejects session JWTs and API tokens in the frame.
Reauthentication must use the same principal. An expired ticket ends the connection if no valid renewal extends it.

Subscribe and synchronize

After reconnecting, restore subscriptions and send synchronize. Wait for {"control":"synchronized"}. Then refetch every REST resource that depends on the stream.

Rooms

One connection can subscribe to at most 32 rooms. It accepts at most 240 client frames per minute and 2 KB per frame.

Events and controls

Event types are PoolLaunch, PoolStats, Ohlcv, Trade, BalanceChange, and ProtocolConfigChanged. Treat ProtocolConfigChanged as invalidation data. Fetch:
If the API returns 503 protocol_revision_pending, wait for Retry-After. Discard or requote any route whose protocol_revision is older than the event revision. Known controls are synchronized and resync_required. On resync_required, refetch affected REST state. Ignore unknown future control values.

Delivery and reconnect

Delivery is at most once. The server does not replay missed events. During deployment it can close with code 1012. Reconnect with backoff and jitter, obtain a fresh ticket, restore rooms, synchronize, and reload REST snapshots.