Websocket
Websocket
is a new HTML5 Protocol. It achieves full-duplex data transmission between the client and the server, allowing data to be transferred effectively in both directions. With just only one handshake, the connection between the client and the server is established. The server will then be able to push data to the client according to preset rules. Its advantages include:
The
WebSocket
request header for data transmission between client and server is approximately 2 bytes onlyEither the client or server can initiate a data transmission
As there is no need to create and delete TCP connection repeatedly, it saves resources for both bandwidth and server
Ws information
The returned data will be binary compressed except the heartbeat data (the user needs to decompress through Gzip algorithm)
Command Format
event
channel
description
sub
market_$symbol_depth_step0
Subscribe depth
unsub
market_$symbol_depth_step0
Unsubscribe depth
sub
market_$symbol_trade_ticker
Subscribe to real-time trade
unsub
market_$symbol_trade_ticker
Unsubscribe real-time trade
sub
market_$symbol_ticker
Subscribe to 24h market data
unsub
market_$symbol_ticker
Unsubscribe 24h market data
sub
market_$symbol_kline_1min
Subscribe to 1min k-line information
req
market_$symbol_kline_1month
Request 1 month historical bar record
Heartbeat
Every once in a while, the server will send a PING
message. The client needs to reply to the PONG
message, otherwise the server will close the connection.
ping
pong
Subscription Full Depth
Payload
Subscription message structure
Subscription Real-Time Trade
Payload
Subscription message structure
Subscription Kline Market
Payload
Subscription message structure
Request History Trade
Payload
Subscription message structure
Request Kline History Data
Payload
Subscription message structure
Subscription Market Tickers
Payload
Subscription message structure
Last updated