Heartbeats
The server sends a WebSocket protocol-level ping every 20 seconds. Stock client libraries, such aswebsockets, ws and gorilla/websocket, answer these automatically, so you don’t need to write any keepalive code. An idle but healthy connection stays open indefinitely between reports.
Reconnection
The protocol is stateless beyond the currently open connection. On any disconnect, wait a few seconds, reconnect, and re-subscribe to the channels you care about. Two things make this safe:- Last-value replay means you’re current again immediately after re-subscribing; see Channels Overview.
- A plan change closes your connections on purpose, so the next connect picks up the new plan’s limits. Treat it like any other disconnect.
Next: Examples
See runnable client code in Python, Node.js, Go and the browser.
