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

# WebSocket Feeds

> Live order book and trade streams

Connect: `wss://ws.into.space/v1`

<Info>
  Public release will be announced on our official X/Twitter and in Telegram + Dicsord
</Info>

## Connection

```javascript theme={null}
const ws = new WebSocket('wss://ws.into.space/v1');

ws.onopen = () => {
  // Connection established
  // Send subscription message
};

ws.onmessage = (event) => {
  const data = JSON.parse(event.data);
  // Handle updates
};
```

## Subscription Format

```json theme={null}
{
  "type": "subscribe",
  "channels": [
    "trades:btc-150k-2025",
    "orderbook:btc-150k-2025:YES",
    "markets"
  ]
}
```

## Channel: Trades

**Subscribe:**

```json theme={null}
{
  "type": "subscribe",
  "channels": ["trades:btc-150k-2025"]
}
```

**Update Message:**

```json theme={null}
{
  "channel": "trades",
  "market": "btc-150k-2025",
  "data": {
    "id": "trade_xyz789",
    "outcome": "YES",
    "price": 0.352,
    "quantity": 2500,
    "side": "BUY",
    "timestamp": 1704153650
  }
}
```

## Channel: Order Book

**Subscribe:**

```json theme={null}
{
  "type": "subscribe",
  "channels": ["orderbook:btc-150k-2025:YES"]
}
```

**Update Message (Snapshot):**

```json theme={null}
{
  "channel": "orderbook",
  "market": "btc-150k-2025",
  "outcome": "YES",
  "type": "snapshot",
  "data": {
    "bids": [
      { "price": 0.349, "quantity": 5000 },
      { "price": 0.348, "quantity": 8500 }
    ],
    "asks": [
      { "price": 0.351, "quantity": 4200 },
      { "price": 0.352, "quantity": 6100 }
    ],
    "timestamp": 1704153650
  }
}
```

**Update Message (Delta):**

```json theme={null}
{
  "channel": "orderbook",
  "market": "btc-150k-2025",
  "outcome": "YES",
  "type": "delta",
  "data": {
    "side": "bids",
    "price": 0.349,
    "quantity": 5500,
    "timestamp": 1704153655
  }
}
```

## Channel: Markets

**Subscribe:**

```json theme={null}
{
  "type": "subscribe",
  "channels": ["markets"]
}
```

**Update Message:**

```json theme={null}
{
  "channel": "markets",
  "data": {
    "id": "btc-150k-2025",
    "probability": 0.352,
    "volume24h": 1260000,
    "liquidity": 455000,
    "timestamp": 1704153650
  }
}
```

## Rate Limits

* **WebSocket connections:** 10 concurrent connections per user

## Error Handling

**WebSocket Error:**

```json theme={null}
{
  "type": "error",
  "code": "INVALID_CHANNEL",
  "message": "Channel format is invalid"
}
```

**Common Error Codes:**

* `INVALID_CHANNEL` - Subscription format incorrect
* `RATE_LIMIT_EXCEEDED` - Too many connections
* `CONNECTION_TIMEOUT` - No activity for extended period
