Realtime
Recorded
Concepts
Guides
API Reference
This page summarizes production retry policy. The runnable reconnect example lives in Reconnect a Live Session.
When to reconnect
| Close code | Meaning | Action |
|---|---|---|
| 1000 | Normal close | Do not reconnect |
| 4408 | Idle timeout | Reconnect immediately |
| 1008 | Session duration / audio limit | Reconnect immediately as a new session |
| 1009 | Frame too large | Fix frame size, then reconnect |
| 1011 | Upstream socket error | Reconnect with backoff |
Backoff
- Use exponential backoff with a cap — for example
min(1000 * 2^attempt, 30000)ms — and reset the counter after a successful connection. - Re-send
session.updateafter reconnecting. Sessions do not resume, and previous utterances are not re-delivered.
HTTP errors
| Status | Meaning | Action |
|---|---|---|
| 429 | Rate limited | Honour Retry-After, then retry |
| 5xx | Server error | Retry with backoff; surface a clear status to the user |