API reference

WitWebSocketJsonRequest Class

Web socket request that encodes a single json request

Constructors

WitWebSocketJsonRequest ( postData , requestId )
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)
Parameters
postData: WitResponseNode
requestId: string

Protected Fields

_timeoutStart : DateTime
Start of the timeout
Signature
DateTime Meta.Voice.Net.WebSockets.Requests.WitWebSocketJsonRequest._timeoutStart
_uploader : UploadChunkDelegate
The method used to upload chunks
Signature
UploadChunkDelegate Meta.Voice.Net.WebSockets.Requests.WitWebSocketJsonRequest._uploader

Properties

Code : string
[Get]
A response code if applicable
Signature
string Meta.Voice.Net.WebSockets.Requests.WitWebSocketJsonRequest.Code
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
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
PostData : WitResponseNode
[Get]
Initial json data to be uploaded
Signature
WitResponseNode Meta.Voice.Net.WebSockets.Requests.WitWebSocketJsonRequest.PostData
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
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

BeginTimeout ()
Generates a task to watch for timeout
Signature
void Meta.Voice.Net.WebSockets.Requests.WitWebSocketJsonRequest.BeginTimeout()
Returns
void
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

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