Skip to main content

Ping

Send a ping frame at least every 5 minutes.
A socket that has not sent a ping in 5 minutes is closed without warning. This is an application-level frame, not a WebSocket protocol ping. Many client libraries send protocol-level pings automatically; those do not satisfy this requirement. Send the JSON frame.
Ping on a fixed interval well inside the deadline — every 30 to 60 seconds is a comfortable margin — rather than trying to ping exactly at the limit.

Reconnecting

A server-initiated close is routine. Reconnect and resubscribe. The server does not send a specific close code on these closes, so most client libraries will report 1005 (“no status received”). Do not treat 1005 as an error condition worth alerting on; treat it as a signal to reconnect. On reconnect you must redo both halves of your session:
1

Re-authenticate

Send authenticate again if you want your private stream. Authentication does not survive a reconnect.
2

Resubscribe

Send your full subscribe target set again. Subscriptions do not survive a reconnect either.
3

Backfill the gap

Reload current state over REST for anything you track cumulatively — positions, open orders, the order book — because updates that occurred while you were disconnected are not replayed.
There is no message replay. The socket streams what happens while you are connected; it does not buffer for absent clients. Any client that needs a complete record must reconcile against REST after a reconnect.