> For the complete documentation index, see [llms.txt](https://docs.bv7x.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.bv7x.ai/use-the-signal/read-the-forecast/websocket.md).

# WebSocket

Real-time signal push over WebSocket. Receive events the moment they happen instead of polling.

***

## Connection

```
wss://bv7x.ai/ws/signal
```

**Authentication**: Basic tier (500M+ $BV7X). Pass the bearer token as a query parameter:

```
wss://bv7x.ai/ws/signal?token=eyJhbGci...
```

***

## Event Types

| Event                 | Description                              | Frequency                |
| --------------------- | ---------------------------------------- | ------------------------ |
| `signal.new`          | New daily signal computed                | Once daily (\~21:35 UTC) |
| `signal.resolved`     | A pending prediction resolved (WIN/LOSS) | As outcomes settle       |
| `wager.placed`        | Polymarket wager executed                | Once daily (\~21:42 UTC) |
| `wager.settled`       | A Polymarket wager settled               | As markets resolve       |
| `attestation.created` | New on-chain attestation written         | Once daily (\~21:38 UTC) |
| `regime.changed`      | Market regime changed                    | When regime transitions  |

***

## Message Format

All messages are JSON with this structure:

```json
{
  "type": "signal.new",
  "data": { ... },
  "timestamp": "2026-03-28T21:35:00Z"
}
```

### signal.new

```json
{
  "type": "signal.new",
  "data": {
    "signal": "SELL",
    "confidence": 0.615,
    "direction": "DOWN",
    "btcPrice": 66027,
    "regime": "BEAR_TREND",
    "horizon": "7d"
  },
  "timestamp": "2026-03-28T21:35:00Z"
}
```

### signal.resolved

```json
{
  "type": "signal.resolved",
  "data": {
    "date": "2026-03-21",
    "direction": "UP",
    "outcome": "WIN",
    "btcAtSignal": 64500,
    "btcAtResolution": 67200
  },
  "timestamp": "2026-03-28T14:15:00Z"
}
```

### wager.placed

```json
{
  "type": "wager.placed",
  "data": {
    "market": "Will BTC be above $66,000 on April 4?",
    "side": "NO",
    "amount": 1.0,
    "odds": 0.42
  },
  "timestamp": "2026-03-28T21:42:00Z"
}
```

### regime.changed

```json
{
  "type": "regime.changed",
  "data": {
    "from": "CHOP",
    "to": "BEAR_TREND",
    "timestamp": "2026-03-28T21:35:00Z"
  },
  "timestamp": "2026-03-28T21:35:00Z"
}
```

***

## JavaScript Example

```javascript
const ws = new WebSocket("wss://bv7x.ai/ws/signal?token=eyJhbGci...");

ws.onopen = () => {
  console.log("Connected to BV-7X signal feed");
};

ws.onmessage = (event) => {
  const msg = JSON.parse(event.data);
  switch (msg.type) {
    case "signal.new":
      console.log(`New signal: ${msg.data.signal} (${msg.data.confidence})`);
      break;
    case "signal.resolved":
      console.log(`Resolved: ${msg.data.date} -> ${msg.data.outcome}`);
      break;
    case "regime.changed":
      console.log(`Regime: ${msg.data.from} -> ${msg.data.to}`);
      break;
  }
};

ws.onclose = () => {
  console.log("Disconnected -- reconnect after a short delay");
};
```

***

## Connection Notes

* The server sends a `ping` frame every 30 seconds. Respond with `pong` to keep the connection alive.
* If the connection drops, wait 5 seconds before reconnecting.
* The token is validated on connection. If it expires mid-session, the connection will close with code 4001.
* Connection limits apply per wallet address to prevent abuse.

***

## Next

* [Webhooks](/use-the-signal/read-the-forecast/webhooks.md) -- push delivery for server-side integrations
* [Copy-Trade API](/use-the-signal/trade-the-forecast/copy-trade.md) -- structured trade intent
