Streaming Audio
Connection Lifecycle
The four phases of a streaming session: connect, stream, end, and close.
The 4 phases
| Phase | SDK Call | Description |
|---|---|---|
| 1. Connect | client.asr.stream() | Opens WebSocket, sends StreamingConfig as handshake. Returns a connection object. |
| 2. Stream | conn.send_audio() | Send raw PCM bytes in chunks. Server emits PARTIAL and FINAL_SEGMENT events continuously. |
| 3. End | conn.end() | Signals end of audio. Server processes remaining audio and emits FINAL. |
| 4. Close | conn.close() | Closes the WebSocket cleanly. Always call after end(). |