Streaming Audio

Connection Lifecycle

The four phases of a streaming session: connect, stream, end, and close.


The 4 phases

PhaseSDK CallDescription
1. Connectclient.asr.stream()Opens WebSocket, sends StreamingConfig as handshake. Returns a connection object.
2. Streamconn.send_audio()Send raw PCM bytes in chunks. Server emits PARTIAL and FINAL_SEGMENT events continuously.
3. Endconn.end()Signals end of audio. Server processes remaining audio and emits FINAL.
4. Closeconn.close()Closes the WebSocket cleanly. Always call after end().