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

# Real-time data

> Stream live data via WebSockets for balances, orderbooks, and trades

Synthesis provides three WebSocket endpoints for real-time updates. All connections use the same pattern: connect, subscribe, receive initial state, then receive live updates.

<CardGroup cols={3}>
  <Card title="Balance" icon="wallet" href="/docs/guides/websockets/balance">
    Stream wallet balances, order fills, and position changes in real-time.
  </Card>

  <Card title="Orderbook" icon="chart-bar" href="/docs/guides/websockets/orderbook">
    Live orderbook snapshots and delta updates for prediction markets.
  </Card>

  <Card title="Trades" icon="arrow-right-arrow-left" href="/docs/guides/websockets/trades">
    Real-time trade executions, volume tracking, and whale alerts.
  </Card>
</CardGroup>

## Connection basics

All WebSocket connections follow the same pattern:

```javascript theme={null}
const ws = new WebSocket("wss://synthesis.trade/ws/{endpoint}");

ws.onopen = () => {
    ws.send(JSON.stringify({
        type: "subscribe",
        // ... subscription parameters
    }));
};

ws.onmessage = (event) => {
    const data = JSON.parse(event.data);
    if (data.success) {
        console.log(data.response);
    }
};
```

The server sends ping frames every 30 seconds to keep connections alive. Your client should respond with pong frames automatically (most WebSocket libraries handle this).

## Endpoints

| Endpoint                             | Max Subscriptions | Description                      |
| ------------------------------------ | ----------------- | -------------------------------- |
| `wss://synthesis.trade/ws/balance`   | 500 wallets       | Wallet balances and order status |
| `wss://synthesis.trade/ws/orderbook` | 5,000 markets     | Orderbook snapshots and deltas   |
| `wss://synthesis.trade/ws/trades`    | 1,000 markets     | Trade executions                 |
