Streaming (WebSocket)
Maintain a persistent WebSocket to stream audio frames with the lowest possible latency. This API is available to Business plans and above.
WebSocket URL
The server enforces global and per-key concurrency limits. Defaults allow up to 20 simultaneous sessions across the cluster and 20 parallel connections per API key. If you hit capacity errors, back off and retry.
Request Flow
- Open a WebSocket connection to the endpoint above.
- Send a JSON payload describing the synthesis request.
- Consume a stream of audio frames and metadata.
- Listen for a terminal
audio_endmessage before closing the socket.
Request Payload
Response Shapes
JSON Frames (binary_response = false)
Audio chunks arrive sequentially until an audio_end message is emitted.
Binary Frames (binary_response = true)
Frames contain contiguous bytes of the requested format. If no_audio_header is false, the first frame includes a standard WAV header with Resemble’s timestamp metadata.
Termination Message
Error Handling
Note: The WebSocket API is limited to Business plan customers. Upgrade on the billing page if you receive
Unauthorizedresponses.
Unrecoverable Errors
Connection-level failures close the socket immediately.
Recoverable Errors
The connection remains open, allowing you to fix the issue and retry.
Log the error_name and request_id so that you can correlate failures with client requests.
