Skip to main content

Quick inspection with JSON mode

By default, the connection starts in JSON mode. In this mode, the server sends text frames with order book diffs for subscribed coins. Example: subscribe to BTC order book diffs.
You should start receiving newline-delimited JSON order book diff events almost immediately. Example response:
JSON mode only delivers order book diffs. It does not deliver:
  • Block frames
  • Ping frames
  • Timing metrics
  • Mempool transactions
For production use, use binary mode.

Production flow with binary mode

Production clients should use the following connection sequence:
  1. Connect to the WebSocket endpoint.
  2. Send esp to upgrade to binary mode.
  3. Send prime to enable pings, metrics, and server error events.
  4. Subscribe to required coins or streams.
  5. Read frames continuously.
  6. On disconnect, reconnect and repeat the full sequence.
Example sequence:
To subscribe to the mempool stream:
The mempool stream may not be enabled on every Hyperliquid Data Stream instance. If it is not available, the server returns a non-disconnecting error.

Rust client example

A complete Rust client is available in the example client implementation. It connects to the stream, upgrades to binary mode, subscribes to one coin, and prints decoded frames. Run:
Required dependencies:
Example connection sequence:
To add the mempool stream:
The read loop should continuously consume incoming frames and dispatch them by tag.