Sessions
A session is one WebSocket connection to a realtime endpoint. It starts when the server sends session.created and ends when the connection closes, normally right after session.closed. The audio and video endpoints share this protocol. Audio realtime and Video realtime cover each endpoint’s media format, configuration, and results.
Messages
Text messages are JSON objects identified by a type field. Media travels as binary frames. Messages follow the compatibility rules.
The audio endpoint also sends utterance.start and utterance.end to mark the start and end of each stretch of speech.
Lifecycle
The server sends session.created
It arrives before the client sends anything. Store the session_id; Hume support uses it to find the session, and it is the ID of the session’s run.
The client sends session.update, if needed
The server confirms with session.updated, listing the full configuration now in effect. Skip this step to use the defaults. Configuration has the rules.
Configuration
The example below changes one field. The confirmation shows the full configuration that results.
- Omitted fields return to their defaults.
session.updatereplaces the configuration rather than merging into it, so include every field you want in effect. - The configuration locks at the first media frame the server takes. A later
session.updateis rejected withconfig_invalid, and the session ends. Which frames lock it differs by endpoint; see Audio configuration and Video configuration. - Unrecognized fields and unsupported values end the session with
config_invalid. - Several updates may be sent until the configuration locks. Each replaces the configuration and is confirmed with
session.updated.
The fields each endpoint accepts are listed under Audio configuration and Video configuration.
Closing
To end a session, send session.close and keep reading until session.closed arrives. Results still in progress are delivered before it. On the audio endpoint, if the final measurement fails, an error arrives first and session.closed carries reason set to error.
session.closed states the reason the session ended and totals what the server received and produced. The totals differ by endpoint; see the audio and video session summaries.
After session.closed, the server closes the WebSocket with the code listed for the reason. Close codes describes every code the server closes with.
If the server cannot continue a session, it closes the connection with code 1011 without sending session.closed, so no reason is given. See Connection failures.
If the client closes the WebSocket instead of sending session.close, the session ends at once. The server sends nothing further, so results in progress and session.closed are lost.
Connection behavior
- Messages arrive in order. The server sends messages in the order it produces them, and results follow the order in which media was accepted.
- The server never sends pings. It answers any ping from the client with a pong.
- A session closes after 30 seconds without a media frame the server can use. It ends with
session.closedandreasonset toidle_timeout. Accepted frames reset the timer, as do audio frames rejected withrate_limited. Invalid frames, video frames rejected withrate_limited, text messages, and pings do not. To pause for longer, end the session and open a new one when you resume. - A session cannot be resumed. However it ended, open a new connection to start another.
Time and identifiers
Time values are integers in milliseconds, measured from the start of the session’s media. session_id is a UUID. The other identifiers (measurement_id, utterance_id, frame_id, and face_id) are integers that start at 0 in every session, increase as the session progresses, and mean nothing outside it. face_id is null for a face that was not measured.
After a session
Every session is recorded as a run, and its session_id is the run’s ID. The run endpoints return its status, the configuration it ran under, and the problems it reported. They do not return measurements, so keep the results you need from the session itself. See Runs.

