Reconnection & Retries

PreviousNext

WebSocket disconnects, 429, 5xx, backoff.

This page summarizes production retry policy. The runnable reconnect example lives in Reconnect a Live Session.

When to reconnect

Close codeMeaningAction
1000Normal closeDo not reconnect
4408Idle timeoutReconnect immediately
1008Session duration / audio limitReconnect immediately as a new session
1009Frame too largeFix frame size, then reconnect
1011Upstream socket errorReconnect 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.update after reconnecting. Sessions do not resume, and previous utterances are not re-delivered.

HTTP errors

StatusMeaningAction
429Rate limitedHonour Retry-After, then retry
5xxServer errorRetry with backoff; surface a clear status to the user