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

WitSocketRequest Class

A WitSocketRequest implementation using web sockets
Meta::WitAi::Requests::WitSocketRequest extends Meta.WitAi.Requests.VoiceServiceRequest.
Meta::WitAi::Requests::WitSocketRequest extends Meta.WitAi.Interfaces.IAudioUploadHandler.

Overview

Properties

The configuration to be used for the request
The script used to transmit data
The audio buffer used for audio based requests
string
Endpoint to be used
Audio encoding used for audio requests
bool
Whether or not the audio stream is ready
Action
Callback when socket connection is ready to send data
Web socket request being performed

Object Data

override bool
Web socket decodes responses automatically

Public Member Functions

WitSocketRequest
( WitConfiguration configuration,
WitWebSocketAdapter webSocketAdapter,
AudioBuffer audioBuffer,
Constructor for audio requests using an audio buffer
Constructor for a text request
Constructor for json response turned into message response
void
Write
( byte [] buffer,
int offset,
int length )
Public method for sending binary audio data

Object Data

override void
Ignore state changes unless setup
override string
Get send error options
override void
Begins uploading data
override void
Handle cancellation
override string
Error returned if audio cannot be activated
override void
Activates audio and calls activated callback once complete
override void
Deactivates audio asap and calls deactivated callback once complete

Details

Properties

WitConfiguration Meta.WitAi.Requests.WitSocketRequest.Configuration
The configuration to be used for the request
WitWebSocketAdapter Meta.WitAi.Requests.WitSocketRequest.WebSocketAdapter
The script used to transmit data
AudioBuffer Meta.WitAi.Requests.WitSocketRequest.AudioInput
The audio buffer used for audio based requests
string Meta.WitAi.Requests.WitSocketRequest.Endpoint
Endpoint to be used
AudioEncoding Meta.WitAi.Requests.WitSocketRequest.AudioEncoding
Audio encoding used for audio requests
bool Meta.WitAi.Requests.WitSocketRequest.IsInputStreamReady
Whether or not the audio stream is ready
Action Meta.WitAi.Requests.WitSocketRequest.OnInputStreamReady
Callback when socket connection is ready to send data
WitWebSocketMessageRequest Meta.WitAi.Requests.WitSocketRequest.WebSocketRequest
Web socket request being performed

Object Data

override bool Meta.WitAi.Requests.WitSocketRequest.DecodeRawResponses
Web socket decodes responses automatically

Member Functions

Meta.WitAi.Requests.WitSocketRequest.WitSocketRequest
( WitConfiguration configuration,
WitWebSocketAdapter webSocketAdapter,
AudioBuffer audioBuffer,
Constructor for audio requests using an audio buffer
Parameters
configuration
Configuration to be used when authenticating web socket client
webSocketAdapter
Adapter used to communicate with web socket client
audioBuffer
Audio input buffer used to obtain audio data
options
Options used for request parameters
events
Event callbacks used for this request
Meta.WitAi.Requests.WitSocketRequest.WitSocketRequest
( WitConfiguration configuration,
WitWebSocketAdapter webSocketAdapter,
Constructor for a text request
Parameters
configuration
Configuration to be used when authenticating web socket client
webSocketAdapter
Adapter used to communicate with web socket client
options
Options used for request parameters
events
Event callbacks used for this request
Meta.WitAi.Requests.WitSocketRequest.WitSocketRequest
( WitConfiguration configuration,
WitWebSocketAdapter webSocketAdapter,
WitWebSocketMessageRequest webSocketRequest,
Constructor for json response turned into message response
Parameters
configuration
Configuration to be used when authenticating web socket client
webSocketAdapter
Adapter used to communicate with web socket client
jsonData
Initial response from server
void Meta.WitAi.Requests.WitSocketRequest.Write
( 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

Object Data

override void Meta.WitAi.Requests.WitSocketRequest.SetState
( VoiceRequestState newState )
Ignore state changes unless setup
override string Meta.WitAi.Requests.WitSocketRequest.GetSendError ( )
Get send error options
override void Meta.WitAi.Requests.WitSocketRequest.HandleSend ( )
Begins uploading data
Parameters
onSendComplete
Callback that handles send completion
override void Meta.WitAi.Requests.WitSocketRequest.HandleCancel ( )
Handle cancellation
override string Meta.WitAi.Requests.WitSocketRequest.GetActivateAudioError ( )
Error returned if audio cannot be activated
override void Meta.WitAi.Requests.WitSocketRequest.HandleAudioActivation ( )
Activates audio and calls activated callback once complete
override void Meta.WitAi.Requests.WitSocketRequest.HandleAudioDeactivation ( )
Deactivates audio asap and calls deactivated callback once complete