WebSocket API version 1
WebSocket API is designed to allow real-time streaming of events happening in OpenDAF runtime.
Usually it's accessible at http://server/opendaf/ws/opendaf or https://server/opendaf/ws/opendaf.
Overview
WS-API communication protocol is mostly event based. Client has to setup watches on objects of interest - measurements, commands, alarms, function modules. Once the watch is setup, WS-API server will transmit current object state, and begin transmitting state change notifications. When the client is no longer interested in given object, it can be unwatched and server will stop transmitting state changes.
Requests
Requests are JSON objects issued by the client. Each request contains request_id assigned by the client. Server executes the request and returns a response.
See request / response schema files request.json
and response.json
here
Requests summary
Request (request.json ) |
Response (response.json ) |
Description |
---|---|---|
#/types/Heartbeat | #/types/Response | Perform connection test |
#/types/WatchMeasurements | #/types/Response | Cancel measurements watch |
#/types/UnwatchMeasurements | #/types/Response | Setup measurements watch |
#/types/WatchCommands | #/types/Response | Setup commands watch |
#/types/UnwatchCommands | #/types/Response | Cancel commands watch |
#/types/WatchFunctionModules | #/types/Response | Setup function modules watch |
#/types/UnwatchFunctionModules | #/types/Response | Cancel function modules watch |
#/types/WatchAlarms | #/types/Response | Setup alarm state change watch |
#/types/UnwatchAlarms | #/types/Response | Cancel alarm state change watch |
#/types/AckAlarms | #/types/Response | Acknowledge alarms |
#/types/OperateAlarms | #/types/Response | Perform bulk operations on alarms |
#/types/WriteCommands | #/types/Response | Perform command write transaction |
#/types/ReadDatabase | #/types/DatabaseResponse | Read configuration database |
WatchMeasurements / UnwatchMeasurements
WatchMeasuremenets request sets up watch on measurements listed. When measurement value, timestamp or quality changes, client is notified with MeasurementUpdateNotification. Initial notification is transmitted by server right after receiving the request.
UnwatchMeasurements cancels watch on measurements listed.
WatchCommands / UnwatchCommands
WatchCommands request sets up watch on commands listed. When command value is written, client is notified with CommandUpdateNotification. Initial notification is transmitted by server right after receiving the request.
UnwatchCommands cancels watch on commands listed.
WatchFunctionModules / UnwatchFunctionModules
WatchFunctionModules request sets up watch on function modules listed. When function module state changes, client is notified with FunctionModuleUpdateNotification. Initial notification is transmitted by server right after receiving the request.
UnwatchFunctionModules cancels watch on function modules listed.
WatchAlarms / UnwatchAlarms
WatchAlarms request sets up watch on alarms listed. When alarm state changes, client is notified with AlarmStateChangeNotification. Initial notification is transmitted by server right after receiving the request.
UnwatchAlarms cancels watch on alarms listed.
AckAlarms
AckAlarms acknowledges alarms listed.
OperateAlarms
OperateAlarms performs bulk activation / deactivations / acknowledge on alarms listed.
WriteCommands
WriteCommands performs command write transaction.
ReadDatabase
Server responds to ReadDatabase request with DatabaseResponse containing definitions of objects requested.
Sollicited response
Solicited response (response to request) is a JSON object always containing: - integer property request_id mirrored from the originating request - boolean property result, true = request succeeded, false = request failed
See schema file response.json
here
Unsolicited notification
Unsolicited (spontaneous) notifications don't carry request_id property. Server transmits them when watched event occurs.
See schema file response.json
here
Notification summary
Notification (response.json ) |
Transmission trigger |
---|---|
#/types/MeasurementUpdateNotification | Measurement value/timestamp/quality change |
#/types/CommandUpdateNotification | Command value/timestamp change |
#/types/FunctionModuleUpdateNotification | Function module state change |
#/types/AlarmStateChangeNotification | Alarm state change |