# Websockets

Use Websockets for low-latency market and account updates.

### Authentication models

Use the auth model required by each stream:

* No auth for Order Book, Chance History, Activity Feed, and Last Trades Feed
* In-band `AUTH` for Order Updates, Balance Updates, and Order Feed
* Private streams use API key auth only

{% hint style="info" %}
After reconnect, authenticate again and restore every subscription.
{% endhint %}

### Endpoint pages

* [Order Book](https://docs.outpoll.com/api/rest-api/websockets/order-book) — real-time best bid, best ask, and last chance per outcome
* [Chance History](https://docs.outpoll.com/api/rest-api/websockets/chance-history) — live probability updates and chart history
* [Account & History Streams](https://docs.outpoll.com/api/rest-api/websockets/account-and-history-streams) — orders, balances, activity, and last trades
* [WebSocket API Reference](https://docs.outpoll.com/api/rest-api/websockets/websocket-api-reference) — full auth, message, and stream reference

### Private stream auth

Send this message right after connect.

```json
{
  "t": "AUTH",
  "d": {
    "apiKey": "<API_KEY>",
    "signature": "<SIGNATURE>",
    "timestamp": "<UNIX_EPOCH_SECONDS>"
  }
}
```

Build `signature` from `timestamp + "GET" + path`.

### Stream groups

#### Public market data

Connect directly:

* `wss://order-book.outpoll.com/event/ws`
* `wss://chance-history-service.outpoll.com/ws`

#### Private account data

Send `AUTH` after connect:

* `wss://order-service.outpoll.com/order/ws`
* `wss://wallet-mutator-view.outpoll.com/balance/ws`
* `wss://history-service.outpoll.com/order/ws`

#### Public activity and trade broadcasts

No auth required:

* `wss://history-service.outpoll.com/history/ws`
* `wss://history-service.outpoll.com/last-trades/ws`
