Subscription
Maintaining Subscription
In order to maintain a subscription to one of the feeds provided by NDAX, it is necessary to send a ping message every 20 seconds. This message is used to keep the connection open and to confirm that the client is still actively subscribed to the feed. If a ping message is not received within the required timeframe, the connection will be closed.
The ping message is a JSON object that contains several fields:
'messageType': The type of message. In this case, it is set to 'ping' to indicate that it is a ping message.
'key': The API public key for the client.
'passphrase': The passphrase for the client.
'timestamp': The current timestamp.
'signature': The signature for the message, which is used to authenticate the request.
Ping Message
{
"messageType": "ping",
"key": "API_PUBLIC_KEY",
"passphrase": "PASSPHRASE",
"timestamp": "TIMESTAMP",
"signature": "SIGNATURE"
}
The purpose of the ping message is simply to keep the subscription active. It does not carry any other data or payload. In order to send a ping message, you will need to provide the required fields in the correct format and send them over the WebSocket connection.
Last updated