Client messages
subscribe
Subscribes the client to a coin or stream. Subscribe to order book diffs for a coin:coin value must be a non-empty string.
Subscribing twice to the same coin is safe and idempotent.
Subscribe to mempool transactions:
mempool.
If the mempool stream is not enabled on the server, the server replies with a non-disconnecting mempool_unavailable error.
unsubscribe
Unsubscribes from a coin or stream.esp
Upgrades the connection to binary protocol mode.1.
If the version does not match, the client is disconnected with the version_mismatch error.
prime
Enables additional binary streams afteresp.
prime, the client can receive:
- Ping frames
- Timing metrics
- Server error events
prime must be sent after esp.
Calling prime before esp disconnects the client with the not_esp error.
unprime
Disables the additional prime streams.prime, this must be called after esp.
JSON mode
JSON mode is the default mode beforeesp is sent.
In this mode, server-to-client frames are text frames containing newline-delimited JSON order book diffs.
A single WebSocket frame may contain multiple JSON lines separated by \n.
Example:
Binary mode
Afteresp, all server-to-client data frames are binary WebSocket frames.
The first byte of every frame is a tag that identifies the frame type.
All multi-byte integers are little-endian.
Block frame
Tag:TinyOrder frame
Tag:coinpriceqtyuser
MempoolTx frame
Tag:u32.
Layout:
Error frames
Errors are delivered as JSON text frames. Example:code field is a stable contract and can be used programmatically.
The message field is intended for humans and may change.
After
prime, clients may also receive informational server error events. These do not necessarily indicate a client-side issue.