Live session reconnections
A live session outlives its WebSocket. If the connection drops (your network, or a server of ours restarting), reconnect to the same URL: the session continues with the same id and the next utterance ids, without lost or repeated transcripts, and its final result covers everything.
With the Gladia SDKs
Section titled “With the Gladia SDKs”Nothing to do. The SDKs reconnect to the same URL when the connection closes abnormally, keep every audio chunk until it is acknowledged, and resend the unacknowledged ones.
With your own client
Section titled “With your own client”- Keep acknowledgments on (
messages_config.receive_acknowledgments, the default). - Keep each audio chunk until an
audio_chunkmessage covers it:data.byte_range[1]is the number of bytes acknowledged since the start of the session. Acknowledgments come regularly as the session goes, so the audio a client keeps stays short. - When the connection closes with any code other than
1000, reconnect to the same URL within 5 minutes, send the kept chunks first, then continue. Audio the session already has is acknowledged again, never transcribed twice. - A
transcriptmessage in flight when the connection broke is not sent again; the session’s result, itspost_final_transcriptand your callbacks have it.
Sending pace
Section titled “Sending pace”Send the audio as it is captured: a live session takes it at real time, plus 30 seconds at once
(what a reconnection resends). Faster, the session closes with 1008: a recording is transcribed by
the pre-recorded API, made for it.
When the session moves from one of our servers to another (a restart, a rebalance), nothing changes for you:
no audio is skipped, the end-of-turn times stay on the session’s timeline, and with diarization the speakers
keep their labels.
Close codes
Section titled “Close codes”| code | meaning | what to do |
|---|---|---|
1000 |
the session ended | nothing |
1006 |
the connection was lost | reconnect, resend the unacknowledged audio |
1008 |
the audio came faster than real time (beyond 30 seconds ahead), or the session asks for an option or setting this cluster does not serve (the close reason says which) | send recordings to pre-recorded instead; fix the option, then create a new session |
1011 |
the session failed on our side | create a new session |
1012 |
a server is restarting | reconnect at once |
4401 |
the URL is invalid, expired, or the session ended; with the reason API key expired, the API key that created the session has passed its expiry date |
create a new session, with another key when its key expired |
4429 |
your API key already has its maximum of live sessions open (the close reason gives the limit) | close a session, then connect the same URL again |
While a dropped session may still resume, GET /v2/live/{id} reports it as
processing; once the 5 minutes have passed, done.