Access URL
Environment | URL |
---|---|
Sandbox | Public stream: wss://stream-pro.sim.hashkeydev.com/quote/ws/v2 |
Production | Public stream: wss://stream-pro.hashkey.com/quote/ws/v2 |
Heartbeat check
When a user's websocket client application successfully connects to HashKey websocket server, the client is recommended to initiate a periodic heartbeat message (ping message) every 10 seconds, which is used to keep alive the connection
Ping message format is as follows:
// From Sent by the user
{
"ping": 1748503859938
}
Pong message format is as follows:
// Public Stream, return server's timestamp
{
"pong": 1748503865406
}
Data Structure
- Currently only support JSON format.
- Binary format is not yet available
Subscribe
Subscribe
{
"topic": "kline",
"event": "sub",
"params": {
"symbol": "ETHUSDT",
"klineType": "1m"
}
}
Subscription successful
{
"topic": "kline",
"event": "sub",
"params": {
"symbol": "BTCUSDT",
"klineType": "1m",
},
"code": "0",
"msg": "Success"
}
Subscription failed
{
"topic": "kline",
"event": "sub",
"params": {
"symbol": "BTCUSDT",
"klineType": "122m"
},
"code": "-100011",
"msg": "Parameter error!"
}
Unsubscribe
Unsubscribe
{
"topic":"kline",
"event":"cancel",
"params":{
"symbol": "BTCUSDT",
"klineType":"1m"
}
}
Unsubscribe result
{
"topic": "kline",
"event": "cancel",
"params": {
"symbol": "BTCUSDT",
"klineType": "1m",
},
"code": "0",
"msg": "Success"
}