Heartbeat Mechanism
Keepalive is handled entirely at the WebSocket protocol layer (RFC 6455 control frames), not with JSON messages.
Server Ping
The server sends a protocol-level Ping frame every 15 seconds. Conformant WebSocket clients (browsers, ws, websockets, tungstenite, etc.) automatically reply with a protocol Pong frame — you don’t write any code for this.
A client that misses a full 15-second interval without a protocol Pong is disconnected.
No application-level ping/pong
There is no {"event": "ping"} / {"event": "pong"} JSON exchange. Sending a JSON text frame like that is rejected with a MALFORMED_REQUEST error frame — it does not count toward keepalive. If your client library exposes ping/pong hooks, make sure they operate on protocol frames, not text messages.
Example Implementation
Reconnection
Implement reconnection with exponential backoff. On reconnect, re-send your subscribe messages — subscriptions do not survive a disconnect.