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

# WebSocket media protocol

> Stream live call audio with 16 kHz Float32LE PCM frames.

Upgrade this endpoint to a WebSocket with the same bearer token used for REST calls.

Client binary frames are outbound peer audio:

| Field       | Value       |
| ----------- | ----------- |
| Encoding    | `Float32LE` |
| Sample rate | `16000` Hz  |
| Channels    | `1` mono    |

Server binary frames are inbound peer audio with the same format.

## Server text frames

```json theme={null}
{
  "type": "ready",
  "media": {
    "direction": "bidirectional",
    "encoding": "Float32LE",
    "sampleRate": 16000,
    "channels": 1
  }
}
```

Backpressure:

```json theme={null}
{
  "type": "buffer",
  "bufferedMs": 240,
  "pauseMs": 500,
  "resumeMs": 250
}
```

Slow or pause your producer when `bufferedMs` reaches `pauseMs`; resume when it drains near `resumeMs`.

Call state:

```json theme={null}
{
  "type": "call_state",
  "call": {
    "callId": "call-123",
    "state": "active"
  }
}
```

Errors:

```json theme={null}
{
  "type": "error",
  "code": "invalid_pcm_frame",
  "message": "Binary frames must be Float32LE PCM with 4-byte alignment"
}
```

Raw audio is only carried by this WebSocket. SSE and webhooks carry metadata events only.
