Controller & Transport
Why controller decides transport
Section titled “Why controller decides transport”Providers expose both methods where available (stream? for WS, transcribe? for HTTP). The controller picks the active transport per session:
transport: 'websocket' | 'http' | 'auto'- Switch behavior without changing provider code
This keeps providers simple and lets apps tune transport per UX/cost needs.
WebSocket — silence policy
Section titled “WebSocket — silence policy”createTranscription({ provider, recorder, transport: 'websocket', connection: { ws: { silencePolicy: 'keep' } }, // 'keep' | 'drop' | 'mute'});keep(default): send all framesdrop: send only during speechmute: keep cadence with zeroed frames in silence
Use drop to save bandwidth or mute when provider expects constant cadence.
HTTP — chunking & “segment‑only”
Section titled “HTTP — chunking & “segment‑only””createTranscription({ provider, recorder, transport: 'http', flushOnSegmentEnd: true, connection: { http: { chunking: { intervalMs: 0, overlapMs: 500, maxInFlight: 1 } } },});Chunking options:
intervalMs: timer‑based flush (set to0for segment‑only)minDurationMs: minimum audio before a timer flushoverlapMs: tail continuity between chunksmaxInFlight: limit parallel HTTP flushestimeoutMs: per‑flush timeout
With flushOnSegmentEnd: true + intervalMs: 0 you get one request per phrase.
Retries (WS)
Section titled “Retries (WS)”createTranscription({ provider, recorder, transport: 'websocket', connection: { ws: { retry: { enabled: true, maxAttempts: 3, baseDelayMs: 300 } } },});On transient errors the controller reconnects with exponential backoff.
Force flush / endpoint
Section titled “Force flush / endpoint”- HTTP:
controller.forceEndpoint()triggers a flush of the current buffer. - WS: if provider supports explicit endpointing, controller forwards
forceEndpoint()to the stream.