Skip to content

glossary

verified July 2026

SSE vs WebSocket for TTS

Both transports stream audio chunks as synthesis proceeds; they differ in connection lifetime and what your infrastructure tolerates. The rule of thumb: sockets for conversations, SSE for one-way streams, bytes for everything that is not live.

01

The two wires, side by side

Same synthesis engine, same first-audio behavior, same request shape — the difference is entirely in what travels on the wire and how long the connection lives.

the actual wire — one SSE utterance, then one WS turn
# SSE — one HTTP response per utterance, no socket state
POST /v1/tts/sse
data: {"data": "<base64 pcm chunk>"}
data: {"data": "<base64 pcm chunk>"}
data: {"done": true, "ttfa_ms": 107, "audio_ms": 2810}

# WebSocket — one socket per call, an utterance per turn
--> {"text": "…", "lang": "en", "voice_id": "caller-42"}
<-- <binary pcm frame> <binary pcm frame> …
<-- {"ttfa_ms": 107, "audio_ms": 2810}

02

Choose by connection shape

  • WebSocket (wss://tts.gandr.ai/ws): a socket amortizes connection setup across a whole call, which matters when every turn pays the latency budget — and barge-in is one message on an open socket.
  • SSE (POST /v1/tts/sse): pays HTTP setup per utterance but needs no connection management at all. Proxies and serverless platforms that buffer or kill long-lived sockets handle SSE fine.
  • One-shot bytes (POST /v1/tts/bytes): a complete WAV in one response, for reminders and prerendered prompts — not a stream at all.

See also

Related sheets.

Every term on this page is measurable on a live call — watch the readout while your own script synthesizes.

See the measured figures live