API reference

WitWebSocketJsonRequest Class

Web socket request that encodes a single json request

Constructors

WitWebSocketJsonRequest ( postData , requestId , clientUserId , operationId )
Constructor which accepts a WitResponseNode as post data and applies request id
Signature
Meta.Voice.Net.WebSockets.Requests.WitWebSocketJsonRequest.WitWebSocketJsonRequest(WitResponseNode postData, string requestId=null, string clientUserId=null, string operationId=null)
Parameters
postData: WitResponseNode
requestId: string
clientUserId: string
operationId: string

Properties

ClientUserId : string
[Get]
The client user identifier that is making the request
Signature
string Meta.Voice.Net.WebSockets.Requests.WitWebSocketJsonRequest.ClientUserId
Code : int
[Get]
A response code if applicable
Signature
int Meta.Voice.Net.WebSockets.Requests.WitWebSocketJsonRequest.Code
Completion : TaskCompletionSource< bool >
[Get]
A task that is used to track completion of this request
Signature
TaskCompletionSource<bool> Meta.Voice.Net.WebSockets.Requests.WitWebSocketJsonRequest.Completion
Error : string
[Get]
An error if applicable
Signature
string Meta.Voice.Net.WebSockets.Requests.WitWebSocketJsonRequest.Error
IsComplete : bool
[Get]
Whether or not complete
Signature
bool Meta.Voice.Net.WebSockets.Requests.WitWebSocketJsonRequest.IsComplete
IsDownloading : bool
[Get]
Whether or not downloading has begun
Signature
bool Meta.Voice.Net.WebSockets.Requests.WitWebSocketJsonRequest.IsDownloading
IsUploading : bool
[Get]
Whether or not uploading has begun
Signature
bool Meta.Voice.Net.WebSockets.Requests.WitWebSocketJsonRequest.IsUploading
Logger : IVLogger
[Get]
Signature
IVLogger Meta.Voice.Net.WebSockets.Requests.WitWebSocketJsonRequest.Logger
OnComplete : Action< IWitWebSocketRequest >
[Get][Set]
Callback when the request has completed due to a cancellation, error or success
Signature
Action<IWitWebSocketRequest> Meta.Voice.Net.WebSockets.Requests.WitWebSocketJsonRequest.OnComplete
OnFirstResponse : Action< IWitWebSocketRequest >
[Get][Set]
Callback when request receives the first chunk of data from the server
Signature
Action<IWitWebSocketRequest> Meta.Voice.Net.WebSockets.Requests.WitWebSocketJsonRequest.OnFirstResponse
OnRawResponse : Action< string >
[Get][Set]
Callback method when raw json response is received
Signature
Action<string> Meta.Voice.Net.WebSockets.Requests.WitWebSocketJsonRequest.OnRawResponse
OperationId : string
[Get]
A unique operation ID to track between services for telemetry
Signature
string Meta.Voice.Net.WebSockets.Requests.WitWebSocketJsonRequest.OperationId
PostData : WitResponseNode
[Get]
Initial json data to be uploaded
Signature
WitResponseNode Meta.Voice.Net.WebSockets.Requests.WitWebSocketJsonRequest.PostData
PublishOptions : PubSubResponseOptions
[Get][Set]
The specific publish options for pubsub
Signature
PubSubResponseOptions Meta.Voice.Net.WebSockets.Requests.WitWebSocketJsonRequest.PublishOptions
RequestId : string
[Get]
Unique request id generated on init
Signature
string Meta.Voice.Net.WebSockets.Requests.WitWebSocketJsonRequest.RequestId
ResponseData : WitResponseNode
[Get]
First decoded json response received
Signature
WitResponseNode Meta.Voice.Net.WebSockets.Requests.WitWebSocketJsonRequest.ResponseData
SimulatedErrorType : VoiceErrorSimulationType
[Get][Set]
Simulated error type
Signature
VoiceErrorSimulationType Meta.Voice.Net.WebSockets.Requests.WitWebSocketJsonRequest.SimulatedErrorType
TimeoutMs : int
[Get][Set]
The timeout in milliseconds from the initial upload to the response from the server. If no response in time, the request will fail.
Signature
int Meta.Voice.Net.WebSockets.Requests.WitWebSocketJsonRequest.TimeoutMs
TopicId : string
[Get][Set]
The specific topic id that is being published to or received via subscription, if applicable.
Signature
string Meta.Voice.Net.WebSockets.Requests.WitWebSocketJsonRequest.TopicId

Protected Methods

HandleComplete ()
Resets the state of the request and marks request as complete.
Signature
virtual void Meta.Voice.Net.WebSockets.Requests.WitWebSocketJsonRequest.HandleComplete()
Returns
void
HandleDownloadBegin ()
Method called for first response handling to mark download begin and perform first response callback on main thread.
Signature
virtual void Meta.Voice.Net.WebSockets.Requests.WitWebSocketJsonRequest.HandleDownloadBegin()
Returns
void
RaiseComplete ()
Method called on main thread when first response callback should occur
Signature
virtual void Meta.Voice.Net.WebSockets.Requests.WitWebSocketJsonRequest.RaiseComplete()
Returns
void
RaiseFirstResponse ()
Method called on main thread when first response callback should occur
Signature
virtual void Meta.Voice.Net.WebSockets.Requests.WitWebSocketJsonRequest.RaiseFirstResponse()
Returns
void
ReturnRawResponse ( jsonString )
If raw response callback is implemented, calls on main thread
Signature
virtual void Meta.Voice.Net.WebSockets.Requests.WitWebSocketJsonRequest.ReturnRawResponse(string jsonString)
Parameters
jsonString: string
Returns
void
SendAbort ( reason )
Method to perform an abort call
Signature
void Meta.Voice.Net.WebSockets.Requests.WitWebSocketJsonRequest.SendAbort(string reason)
Parameters
reason: string
Returns
void
SetResponseData ( newResponseData )
Apply response data
Signature
virtual void Meta.Voice.Net.WebSockets.Requests.WitWebSocketJsonRequest.SetResponseData(WitResponseNode newResponseData)
Parameters
newResponseData: WitResponseNode  New response data received
Returns
void
UpdateTimeoutStart ()
Refresh timeout start to current utc time
Signature
void Meta.Voice.Net.WebSockets.Requests.WitWebSocketJsonRequest.UpdateTimeoutStart()
Returns
void
UploadChunk ( uploadJson , uploadBinary )
Upload data to the web socket
Signature
void Meta.Voice.Net.WebSockets.Requests.WitWebSocketJsonRequest.UploadChunk(WitResponseNode uploadJson, byte[] uploadBinary)
Parameters
uploadJson: WitResponseNode
uploadBinary: byte []
Returns
void
WaitForTimeout ()
Timeout if needed
Signature
async Task Meta.Voice.Net.WebSockets.Requests.WitWebSocketJsonRequest.WaitForTimeout()
Returns
async Task

Methods

Cancel ()
Cancel current request
Signature
virtual void Meta.Voice.Net.WebSockets.Requests.WitWebSocketJsonRequest.Cancel()
Returns
void
HandleDownload ( jsonString , jsonData , binaryData )
Called one or more times from the background thread when a chunk has returned. Stores the json data from the first response.
Signature
virtual void Meta.Voice.Net.WebSockets.Requests.WitWebSocketJsonRequest.HandleDownload(string jsonString, WitResponseNode jsonData, byte[] binaryData)
Parameters
jsonString: string  Raw json string.
jsonData: WitResponseNode  Decoded json data object.
binaryData: byte []  Decoded binary data chunk which may be null or empty.
Returns
void
HandleUpload ( uploadChunk )
Called once from the main thread to begin the upload process. Sends a single post chunk.
Signature
virtual void Meta.Voice.Net.WebSockets.Requests.WitWebSocketJsonRequest.HandleUpload(UploadChunkDelegate uploadChunk)
Parameters
uploadChunk: UploadChunkDelegate  The method to be called as each json and/or binary chunk is ready to be uploaded
Returns
void
ToString ()
Override ToString for more request specific info
Signature
override string Meta.Voice.Net.WebSockets.Requests.WitWebSocketJsonRequest.ToString()
Returns
override string