Wait for the server's Termination
frame before closing the socket. While waiting you still receive the final
transcript and the session information.
How long to wait for that frame, in
milliseconds. 0 waits indefinitely. The socket closes either way.
The Termination frame (audio_duration_seconds,
session_duration_seconds), or undefined when close() did not wait
for it or it did not arrive before the timeout or the socket closed.
The close listener is called before this resolves, unless the session
never opened or the socket had already closed and reported it.
Open the streaming session.
Resolves with the server's Begin event once the handshake completes. A
single attempt is bounded by connectTimeout (default 1000ms); transient
failures (timeout, network drop, unexpected close) are retried up to
maxConnectionRetries times (default 2), waiting connectionRetryDelay
(default 500ms) between attempts. Permanent failures (auth, insufficient
funds, malformed config) are not retried.
Unlike previously, a failed connection now rejects this promise rather
than only invoking the error listener — necessary for the caller (and
the retry loop) to observe the failure.
Send PCM audio.
In single-channel mode, audio is forwarded directly to the WebSocket and
options is ignored.
In dual-channel mode (when channels is configured), options.channel is
REQUIRED and must match one of the declared channel names. Per-channel PCM is
fed into that channel's VAD, accumulated into a per-channel ring buffer, and
a scheduled flush (channelAttribution.flushIntervalMs, default 50ms) mixes
the buffers into mono before sending to the WebSocket.
Optionaloptions: SendAudioOptionsUpdate the streaming configuration mid-stream.
The fields to update, by their snake_case wire names or the camelCase names of the connection params. Unrecognized keys are sent unchanged, with a warning.
Close the connection to the server.