API reference
API reference
Select your platform
No SDKs available
No versions available

WitWebSocketSpeechRequest Class

Performs a request that transmits raw audio samples to a web service, downloads and encodes responses.
Meta::Voice::Net::WebSockets::Requests::WitWebSocketSpeechRequest extends Meta.Voice.Net.WebSockets.Requests.WitWebSocketMessageRequest.

Overview

Properties

bool
Callback when the server is ready to upload audio

Events

Action
Callback action when ready for input is toggled on

Public Member Functions

WitWebSocketSpeechRequest
( string endpoint,
Dictionary< string, string > parameters,
string requestId )
Constructor for request that posts binary audio data
override void
Called once from the main thread to begin the upload process. Sends a single post chunk.
override void
HandleDownload
( WitResponseNode jsonData,
byte [] binaryData )
Called multiple times as partial responses are received. Determines if ready for input and if so, performs the appropriate callback following the application of data.
void
SendAudioData
( byte [] buffer,
int offset,
int length )
Public method for sending binary audio data
void
Stop sending audio data

Object Data

override void
Remove upload handler on completion

Details

Properties

bool Meta.Voice.Net.WebSockets.Requests.WitWebSocketSpeechRequest.IsReadyForInput
Callback when the server is ready to upload audio

Events

Action Meta.Voice.Net.WebSockets.Requests.WitWebSocketSpeechRequest.OnReadyForInput ( )
Callback action when ready for input is toggled on

Member Functions

Meta.Voice.Net.WebSockets.Requests.WitWebSocketSpeechRequest.WitWebSocketSpeechRequest
( string endpoint,
Dictionary< string, string > parameters,
string requestId )
Constructor for request that posts binary audio data
Parameters
endpoint
The endpoint to be used for the request
parameters
All additional data required for the request
requestId
A unique id to be used for the request
override void Meta.Voice.Net.WebSockets.Requests.WitWebSocketSpeechRequest.HandleUpload
( UploadChunkDelegate uploadChunk )
Called once from the main thread to begin the upload process. Sends a single post chunk.
Parameters
uploadChunk
The method to be called as each json and/or binary chunk is ready to be uploaded
override void Meta.Voice.Net.WebSockets.Requests.WitWebSocketSpeechRequest.HandleDownload
( WitResponseNode jsonData,
byte [] binaryData )
Called multiple times as partial responses are received. Determines if ready for input and if so, performs the appropriate callback following the application of data.
Parameters
jsonData
Decoded json data object.
binaryData
Decoded binary data chunk which should be null or empty.
void Meta.Voice.Net.WebSockets.Requests.WitWebSocketSpeechRequest.SendAudioData
( byte [] buffer,
int offset,
int length )
Public method for sending binary audio data
Parameters
buffer
The buffer used for uploading data
offset
The starting offset of the buffer selection
length
The length of the buffer to be used
void Meta.Voice.Net.WebSockets.Requests.WitWebSocketSpeechRequest.CloseAudioStream ( )
Stop sending audio data

Object Data

override void Meta.Voice.Net.WebSockets.Requests.WitWebSocketSpeechRequest.HandleComplete ( )
Remove upload handler on completion
Did you find this page helpful?