Voice Socket
Limits & Errors
Defaults that keep sessions healthy and protect both sides from runaway connections. Some are tunable per organization — talk to us if you need higher limits.
Session limits
| Limit | Default | What happens at the edge |
|---|---|---|
| Idle timeout | 60 s with no inbound audio | Session closes (session.ended). No human hangs up a socket, so silence ends it. |
| Max session length | Agent's max, else 1800 s (30 min) | error with code max_session_time, then close. |
| Max inbound frame | 64 KB per binary frame | Oversized frames are dropped (the session continues). |
| Slow consumer | 10 s send timeout | If you can't drain agent audio fast enough, the session closes rather than buffering unboundedly. |
Keep audio frames small and steady (tens of ms each), and play agent audio as it arrives.
Connection limits (per product)
| Limit | Default | At the edge |
|---|---|---|
| Concurrent sessions | 20 | New connections rejected with close 4429 until one frees up. |
| Connection rate | 30 per 60 s | Bursts beyond the window rejected with 4429. |
These guard against a single key opening thousands of sockets. If you hit them legitimately, back off and retry, or request a higher cap.
WebSocket close codes
When a session can't start or must stop, the server sends an error frame (where possible) and closes with an application code:
| Code | Meaning | Typical error.code |
|---|---|---|
4401 |
Unauthorized — missing/invalid key or token | unauthorized |
4403 |
Forbidden — wrong agent for the token, or empty wallet | forbidden, insufficient_balance |
4409 |
Session rejected by the control plane | rejected and others |
4422 |
Agent mode not supported on the socket | unsupported_mode |
4429 |
Too many sessions / connecting too fast | rate/concurrency reason |
4500 |
Server-side failure | init_failed |
A normal end (you sent end or closed) uses a standard 1000 close after the session.ended frame.
Error frames mid-session
Errors that occur while running arrive as a JSON error frame:
{ "v": 1, "type": "error", "code": "engine_error", "message": "…" }code |
Meaning |
|---|---|
engine_error |
The agent pipeline hit an error |
max_session_time |
The session reached its hard duration cap; close follows |
Recommended client behaviour
- Reconnect on unexpected close, but back off on
4429and don't retry on4401/4403(fix the credential first). - Treat
interruptedas "flush playback now" — it's how barge-in stays snappy. - Mint a fresh token per browser connection (Auth); they expire in ~60 s.
Next
- Protocol Reference
- Webhooks —
call.endedfires for socket sessions too
