Skip to main content

Heartbeats

The server sends a WebSocket protocol-level ping every 20 seconds. Stock client libraries, such as websockets, 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.
Build your reconnect loop once, with a short backoff, and reuse it everywhere. See the Examples section for a complete implementation in four languages.

Next: Examples

See runnable client code in Python, Node.js, Go and the browser.