V-Blaze and V-Cloud Online Help

WebSocket API Interface

The WebSocket interface allows for bidirectional streaming of data to and from the V‑Blaze REST API.

Opening a Connection

To initiate a WebSocket connection, connect to ws://<webapi_host_here>:17171/transcribe using any typical WebSocket client. Note that WebSocket Secure (wss) is not supported.

All transcription tags must be specified in either the connection query string:

ws://webapi:17171/transcribe?model=eng1:callcenter&output=text

Or the HTTP headers in the following format:

  • X-Voci-Model: eng1:callcenter

  • X-Voci-Output: text

Submitting Audio

Once successfully connected, audio may be submitted by writing directly to the WebSocket. Any number of write calls may be made and the audio data may split between write calls in any manner. Once all audio has been submitted, a WebSocket write of 0 bytes (an empty dataframe) must be used to indicate that all audio has been submitted.

Receiving Results

Results may be received in a variety of formats depending on the tags.

Default

By default, a single textual transcript or a zipped file, depending on the provided tags, will be returned to the client. This response is guaranteed to be sent within a single textual (for transcripts) or binary (for zipped data) WebSocket message.

Utterance Streaming

If outstream=true and no utterance_callback is provided, utterance results will be streamed back to the client. Each utterance result will be sent in its own textual WebSocket message. After all utterance results are sent, an empty message will be sent, followed by the complete transcription.

Scrubbed Audio Streaming

If scrubaudio=true and outstream=true, utterance and audio data will both be streamed back to the client. Utterance data will always be contained within textual WebSocket messages while audio data will be within binary WebSocket messages. The utterance and audio message may be interleaved. Like with non-audio streaming, the last textual WebSocket message sent will contain the complete transcription.

Note that the outstream tag defaults to true when realtime=true is specified, so it does not need to be explicitly specified.

Closing the Connection

Once the API has returned all response data, it will initiate a close. Any client-initiated close will be interpreted as an error and may result in the loss of data.

For a full code sample using the WebSocket interface, refer to WebSocket Example.