WitWebSocketJsonRequest Class
Web socket request that encodes a single json request
Unique request id generated on init
The client user identifier that is making the request
The specific topic id that is being published to or received via subscription, if applicable.
The specific publish options for pubsub
The timeout in milliseconds from the initial upload to the response from the server. If no response in time, the request will fail.
Whether or not uploading has begun
Whether or not downloading has begun
TaskCompletionSource< bool > Completion[Get]
A task that is used to track completion of this request
A response code if applicable
Initial json data to be uploaded
First decoded json response received
Action< string > OnRawResponse[Get]
Callback method when raw json response is received
Callback when request receives the first chunk of data from the server
Callback when the request has completed due to a cancellation, error or success
The method used to upload chunks
DateTime _lastResponseReceivedTime[Get]
WitWebSocketJsonRequeststring requestId,
string clientUserId )
Constructor which accepts a WitResponseNode as post data and applies request id
virtual void HandleUpload Called once from the main thread to begin the upload process. Sends a single post chunk.
ParametersuploadChunkThe method to be called as each json and/or binary chunk is ready to be uploaded
virtual void HandleDownload ( string jsonString,
byte [] binaryData )
Called one or more times from the background thread when a chunk has returned. Stores the json data from the first response.
ParametersjsonStringRaw json string.
jsonDataDecoded json data object.
binaryDataDecoded binary data chunk which may be null or empty.
override string ToString ( )
Override ToString for more request specific info
async Task WaitForTimeout ( )
void SendAbort ( string reason )
Method to perform an abort call
virtual void ReturnRawResponse ( string jsonString )
If raw response callback is implemented, calls on main thread
virtual void SetResponseData Apply response data
ParametersnewResponseDataNew response data received
virtual void HandleDownloadBegin ( )
Method called for first response handling to mark download begin and perform first response callback on main thread.
virtual void RaiseFirstResponse ( )
Method called on main thread when first response callback should occur
virtual void HandleComplete ( )
Resets the state of the request and marks request as complete.
virtual void RaiseComplete ( )
Method called on main thread when first response callback should occur