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

# Socket.IO — bets

> bets:subscribe / bets:unsubscribe / bets:update — exact payloads, the wallet cap, and reconnect behavior.

Realtime bet updates over Socket.IO. Connect to `https://api.chance.money` with path `/socket.io`; no auth — wallet rooms are public (results and proofs are public data; the server seed is never sent).

## Events

| Event              | Direction       | Payload                                                                                                        |
| ------------------ | --------------- | -------------------------------------------------------------------------------------------------------------- |
| `bets:subscribe`   | client → server | `{ wallets: string[] }` — addresses to follow (max 50 per message)                                             |
| `bets:unsubscribe` | client → server | `{ wallets: string[] }` to drop specific wallets; a payload that fails validation clears **all** subscriptions |
| `bets:subscribed`  | server → client | `{ ok: true, wallets: string[] }` — the socket's full current subscription set (also sent as the ack)          |
| `bets:update`      | server → client | A `BetRealtimeUpdate` for any subscribed wallet                                                                |

```ts TypeScript theme={"theme":"css-variables"}
import { io } from 'socket.io-client'

const socket = io('https://api.chance.money', { path: '/socket.io' })

socket.on('connect', () => {
  socket.emit(
    'bets:subscribe',
    { wallets: ['0xabc…'] },
    (ack) => console.log('subscribed to', ack.wallets),
  )
})

socket.on('bets:update', (update) => {
  // update.betId, update.status, update.payout, update.proof, ...
})
```

Invalid subscribe payloads ack `{ ok: false, error: 'invalid_payload' }`. Malformed addresses are silently skipped; accepted addresses are normalized to lowercase.

## The update payload

`bets:update` carries the same shape as [`betResult`](/api-reference/bet-result): `t` (`bet_placed` / `bet_result` / `bet_settled` / `bet_claimed`), `status` (`pending` / `computed` / `settled` / `claimed`), amounts as decimal strings, `entropy`, `proof` (nullable), transaction hashes, and attribution. Field-by-field semantics: [Results & proofs](/integrate/results-and-proofs).

## Limits and reconnects

* **50 wallets per socket.** Subscribes beyond the cap are dropped (the ack's `wallets` array tells you what actually stuck). Need more? Open another socket or rotate subscriptions.
* **Subscriptions don't survive reconnects.** Socket.IO reconnects create a fresh server-side session — always re-emit `bets:subscribe` in your `connect` handler, as above.
* **Delivery order isn't guaranteed.** Treat `settled` / `claimed` as terminal for a `betId` and ignore later `pending` / `computed` updates for it.

<Tip>
  On reconnect, bridge the gap with a [`betResults`](/api-reference/bet-result) batch fetch for any bets that were in flight — socket for liveness, GraphQL for truth-at-a-point.
</Tip>
