Heartbeat
The server sends a HEARTBEAT every 10 seconds to every connection, from the moment it opens and whether or not it has subscribed to anything. It expects no reply: there is no application-level pong. The connection has an idle timeout of 300 seconds, though, so a recommended strategy is to send a native WebSocket ping each time a heartbeat arrives. If no pong comes back, close the socket and reconnect.
Connection-level messages on the shared socket: authentication, generic subscribe and unsubscribe, heartbeats and errors.
const socket = new WebSocket("wss://streams.fast.onetrading.com/");socket.addEventListener("message", (event) => { console.log(event.data);});Sent to every connection every 10 seconds, from the moment it opens. No reply is expected. The connection has an idle timeout of 300 seconds, so a recommended keep-alive strategy is to send a native WebSocket ping each time a heartbeat arrives. If no pong arrives, close the socket and reconnect.
- payload
channel_name*stringSYSTEM.
subscription*stringSYSTEM.
time*integerTime the heartbeat was sent, in nanoseconds. Stamped by the WebSocket server, so it may be up to 1 second out.
int64type*stringHeartbeat
{ "channel_name": "SYSTEM", "subscription": "SYSTEM", "time": 1738602951685556000, "type": "HEARTBEAT"}