Websocket
There are 5 basic operations available from the client subscriber:
- Open websocket
- Request currently active alarms
- Request specific alarms based on sequence ID
- Request the latest sequence ID
- Close websocket
The websocket is built on reliable transport so as long as the websocket is up, no alarms are lost. However, to aid in baselining the currently active alarms and to support retrieval of any missing alarms, operations #2 through #4 above are available over the websocket to aid in resychronization. Either can be requested via the same websocket with a websocket send() command, once the websocket session is successfully established. With this inherent functionality, there is no need to use the REST API to retrieve alarms or request resubmission of alarms.
The websocket feature allows you to send requests using stringified JSON objects that contains the requested action and other associated parameters. In JavaScript, the stringified JSON is sent using the command:
ws.send (JSON.stringify(request))
where “request” is the JSON object, and ws is the websocket object.
For requesting active alarms, the request JSON object is represented as:
{
action: "ACTIVE_ALARMS",
type: null,
data: null
}
When this action is requested, the current alarm stream is paused until the set of currently active alarms is sent. Currently active alarms have a sequence ID of “-1”.
For requesting missing alarms by sequence IDs the JSON request includes 3 key/values as below:
{
action: "RESUBMISSION",
type: "SEQUENCE_ID",
data: "["1","2","4-6","7-LATEST"]"
}
where “data” is a stringified list of of sequence IDs and/or range of sequence IDs. Eg, [“2”, “4-6”]. When this action is requested, the missing alarms are sent along with the current alarm stream. LATEST is provided as a means to send all alarms from the starting sequenceId up to the current sequenceId.
For requesting the latest sequence ID, the JSON request is structured as below:
{
"action": "LATEST_SEQ_ID",
"type": null,
"data": null
}
The response back from Orchestrator will include a sequenceId = -2, along with the latest Sequence ID.
Note that another method for requesting missing alarms can be achieved by using the Orchestrator REST APIs – this method, however, would require additional authentication and cookie management as this session is independent of the websocket session.
NOTE: When enabling WEBSOCKET receiver setting for On-Premise Orchestrator. You need to add the IP address in the IP allow list and do one of the following:
- Include the key in the HTTP header "X-Auth-Token"
- Append the key as the query parameter "key" to the WebSocket URL
Updated 2 months ago