Salesforce

WebSocket messages

« Go Back
Information
WebSocket messages
000003985
Public
Product Selection
aiWare - aiWare
Article Details

Certain messages need to be exchanged between the client and server (the AI Processing controller in this case) over the WebSocket connection to enable and manage the task or job subscriptions.

Messages are JSON objects, with 2 common fields:

  • msgType for type of the message
  • timestamp in RFC3339-format of the timestamp from the sender
[Tip] Typically, the client script would send the first message to subscribe to a job or task output only after the initial handshake for the WebSocket connection is established.
MessageSenderFormatNotes
subscribeClient{

"msgType": "subscribe",

"timestamp":"2021-07-04T07:00:00Z",

"taskID": "<taskID>", "jobID": "<jobID>", "token": "edge API token for authentication"

}

  • Either taskID or jobID is required
  • IDs can either be internal or from AI Data
ackController{

"msgType": "ack",

"ackMsgType": "subscribe",

"timestamp":"2021-07-04T07:00:01Z",

"taskID": "<taskID>",

"jobID": "<jobID>",

"status": "OK"

}

  • ackMsgType refers to which message this ack is for.
  • status may contain an error description if the request is invalid. OK for success.
taskOutputController{

"msgType": "taskOutput",

"timestamp":"2021-07-04T07:00:00Z",

"taskID": "<taskID>",

"jobID": "<jobID>",

"chunkID": "<chunkID>",

"aion": { ... },

"text": "xxx",

}

Either aion or text must be present.
  • aion is the engine output standard for aiWARE.
  • If the output is text, text is used.
unsubscribeClient{

"msgType": "unsubscribe",

"timestamp":"2021-07-04T07:00:00Z",

"taskID": "<taskID>",

"jobID": "<jobID>",

"token": "edge API token for authentication"

}

This stops listening to a specific taskID or jobID. The IDs can either be internal or AI Data
taskStatusController{

"msgType": "taskStatus",

"timestamp":"2021-07-04T07:00:00Z",

"taskID": "<taskID>",

"jobID": "<jobID>",

"failureCode": "xxx",

"failureReason": "xxx"

"status" : "aborted, failed, complete"

}

This sends final status changes to the client for the task. Status options are:
  • complete
  • aborted
  • failed
If failed, the failureCode and failureReason will be set.
Additional Technical Documentation Information
Properties
11/21/2023 8:19 PM
12/4/2023 6:33 PM
12/4/2023 6:33 PM
Documentation
Documentation
000003985
Translation Information
English

Powered by