# 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](/api/rest-api/websockets/order-book.md) — real-time best bid, best ask, and last chance per outcome
* [Chance History](/api/rest-api/websockets/chance-history.md) — live probability updates and chart history
* [Account & History Streams](/api/rest-api/websockets/account-and-history-streams.md) — orders, balances, activity, and last trades
* [WebSocket API Reference](/api/rest-api/websockets/websocket-api-reference.md) — 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`


---

# Agent Instructions: 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.outpoll.com/api/rest-api/websockets.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.
