> For the complete documentation index, see [llms.txt](https://docs.unix.market/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.unix.market/websocket/connection-and-subscription.md).

# Connection & Subscription

UniX provides a single unified WebSocket endpoint for all channel categories — public market data, on-chain explorer events, and per-user updates.

{% hint style="info" %}
**No authentication required.** User channels are subscribed by `address`; any address is publicly observable.
{% endhint %}

## Endpoints

| Surface   | URL                              |
| --------- | -------------------------------- |
| Standard  | `wss://ws.lynxtrade.pro/v1`      |
| Fast Lane | `wss://ws.lynxtrade.pro/v1/fast` |

## Connection Rules

| Rule               | Detail                                                                                                 |
| ------------------ | ------------------------------------------------------------------------------------------------------ |
| Subscribe deadline | Send a `subscribe` message within **10 seconds** of opening the connection, or the server disconnects. |
| Channel limit      | **50 channel instances** per connection.                                                               |
| Compression        | `permessage-deflate` supported.                                                                        |
| Message format     | JSON, UTF-8.                                                                                           |

## Heartbeat

Send a ping every 30 seconds. The server disconnects after 60 seconds with no heartbeat.

```json
// Client → Server
{ "op": "ping" }

// Server → Client
{ "op": "pong", "time": 1719500000000 }
```

## Subscribing

```json
{
  "op": "subscribe",
  "args": [
    { "channel": "bbo", "symbol_id": 100001 },
    { "channel": "order", "address": "0xabc…def" }
  ]
}
```

Unsubscribing is identical with `"op": "unsubscribe"`.

```json
{ "op": "subscribe", "success": true, "args": [...] }
```

## Push Format

All channels share this envelope:

```json
{
  "channel": "<channel>",
  "symbol_id": "<symbol_id>",
  "type": "<type>",
  "ts": 1719500000000,
  "finality": "final",
  "data": { ... }
}
```

| Field       | Meaning                                                                                                                               |
| ----------- | ------------------------------------------------------------------------------------------------------------------------------------- |
| `channel`   | Channel name.                                                                                                                         |
| `symbol_id` | Present for market-data channels. Omitted for Explorer / User.                                                                        |
| `type`      | Sub-type identifier. Used where a channel emits multiple shapes (e.g. `l2_book` emits `"snapshot"` and `"delta"`). Omitted otherwise. |
| `ts`        | Server push time, Unix milliseconds.                                                                                                  |
| `finality`  | Always `"final"` — data is block-finalized before being pushed (3-block finality, ≈ 150 ms).                                          |
| `data`      | Channel-specific payload.                                                                                                             |

## Compact Field Naming

WebSocket `data` payloads use compact field names. Starting with API v1.10, compact keys use lowercase mnemonic fields only. Do not infer meaning from uppercase/lowercase pairs; use each channel's mapping table.

## Push Timing

> **All** channels push after block finalization (3-block finality, \~150 ms). A channel only pushes when its data has actually changed — **empty blocks produce no push**.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.unix.market/websocket/connection-and-subscription.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
