> ## Documentation Index
> Fetch the complete documentation index at: https://docs.hypedexer.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Live data WebSocket

> Hypedexer WebSocket: connection and protocol

The **Live Data WebSocket API** provides real-time streaming via `GET /ws` on `wss://api.hypedexer.com`. The sidebar documents all available subscriptions and their schemas.

## Connection

```text theme={null}
wss://api.hypedexer.com/ws
```

Authenticate the handshake with `X-API-Key: <key>`, `Authorization: Bearer <key>` or `?api_key=<key>`. The server answers `{"type": "connected"}`, then sends `{"type": "ping", "ts": <ms>}` every 60 seconds; reply `{"method": "pong"}` or the connection is closed after about 180 seconds with code `4000`. Full details in the [WebSocket overview](/websocket/overview).

## What this section covers

The subscriptions below mirror Hyperliquid's own feeds and share one envelope, `{"channel": "<name>", "data": {...}}`:

* **Market data**: `allMids`, `trades`, `candle`, `allCandles`, `bbo`, `l2Book`, `l4Book`, `l4BookUpdates`
* **Asset context**: `activeAssetCtx`, `allActiveAssetCtx`, `fundingRates`, `setOracleUpdates`
* **Fills and orders**: `userFills`, `allFills`, `orderUpdates`, `allTwapStatusUpdates`
* **Account and events**: `userEvents`, `userFundings`, `userNonFundingLedgerUpdates`, `webData2`

Each subscription is acknowledged before its first data frame: `l2Book`, `l4Book`, `l4BookUpdates` and `bbo` with `{"type":"subscriptionUpdate","subscription":{...},"active":true}`, every other one with `{"channel":"subscriptionResponse","data":{"method":"subscribe","subscription":{...}}}`. With `?mode=mirror`, `l2Book` also answers `subscriptionResponse`.

<Note>
  `?mode=mirror` restricts a connection to these subscriptions. It is optional: without it, the same socket also serves the indexed [liquidations](/websocket/ws-liquidations) stream, whose frames use a different envelope (`{"type":"liquidation","count":N,"data":[...]}`).
</Note>

## Protocol

All messages are JSON. The client sends **subscribe**, **unsubscribe**, and **pong** messages. The server sends acknowledgements, snapshots, and real-time updates.

```json theme={null}
// Subscribe to a live event
{"method": "subscribe", "subscription": {"type": "allFills"}}

// Unsubscribe
{"method": "unsubscribe", "subscription": {"type": "allFills"}}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.