If a websocket client disconnects, and they have enabled cancel-on-disconnect during authentication, orders placed by that connection will be cancelled upon detection of the disconnect. This is independent of any heartbeat messages.
In addition, we support optional bi-directional heartbeats:
- The websocket client can send
heartbeat_requestmessages to the server and getheartbeat_responsemessages back if it wishes to probe the aliveness of the server. The websocket client can choose to disconnect if it does not receive a response. - The websocket client can request that the server send it
heartbeat_requestmessages on an interval, upon which the client is expected to send aheartbeat_responsemessage. If aheartbeat_responsemessage from the client is not received, the client is disconnected.
heartbeat_request and heartbeat_response messages follow the same format, whether they are initiated by the server or the client.
Heartbeat Requests
These heartbeats are formatted similarly to normal requests, with the following characteristics:
msg_type:heartbeat_requestid: The ID of the request, an integerversion: The API version (currently 1)- There is no request body. The "body" element may be null or an empty object.
The heartbeat message from the client to the exchange is formatted as follows:
[
{
"msg_type": "heartbeat_request",
"id": 1002,
"version": 1
}
]Heartbeat Responses
These heartbeats are formatted similarly to normal responses, with the following characteristics:
msg_type:heartbeat_responseid: The ID of the corresponding heartbeat request, an integerversion: The API version (currently 1)- There is no response body. The "body" element may be null or an empty object.
The heartbeat message from the client to the exchange is formatted as follows:
[
{
"msg_type": "heartbeat_response",
"id": 1002,
"version": 1
}
]