General Information

Websocket URL

wss://api.huobi.pro/hbus/ws

Data Format

The return data from the Websocket API will need to be unzipped.
Huobi US recommends using pako with node and gzip with python.

Websocket library

Huobi US recommends using ws with node and websocket with python.

Heartbeat

The server will send a ping message to the client through the websocket every 5s (maybe change in the future) and will expect a pong response. When client receives this heartbeat message, it should response with a matching "pong" message which has the same integer in it. If server don't get 'pong' response within two 'ping' period (will be 10s for now) the connection will be closed. This ping/pong interaction is referred to as a heartbeat.

//WebSocket Server Request
{
    "ping": 18212558000
}

//WebSocket Client response
{
    "pong": 18212558000
}

If the type of 'ping' is not Long, the server will return an error like the following:

{
  "ts": 1492420473027,
  "status": "error",
  "err-code": "bad-request",
  "err-msg": "invalid ping"
}