Close Stream
Use the CloseStream message to close the WebSocket stream. Flux decodes the audio it has already received — emitting the corresponding interim Update messages — and then closes the connection.
Purpose
In conversational audio processing, there are scenarios where you need to stop a stream and close the connection. The CloseStream message instructs the server to finish decoding the audio it has already received, emit the corresponding Update messages, and then terminate the WebSocket connection.
CloseStream does not finalize the active turn. No EndOfTurn event is emitted, so the last message you receive is an interim Update, not a confirmed final transcript — treat the most recent Update as the final transcript for the stream. Flux does not emit a summary metadata object, and the server closes the connection without sending a WebSocket close status code.
Example Payloads
To send the CloseStream message, you need to send the following JSON message to the server:
Upon receiving CloseStream, the server emits Update messages for any audio it has already received, then closes the connection. A representative interim Update:
Related Resources
- Configure - Update stream configuration mid-stream
- Force End Turn - End the current turn immediately from an external signal
- Getting Started with Flux - Quickstart guide with basic configuration