Interaction with backend server¶
Client application can connect to WCS OAM backend server to receive metrics data and to manage data aquisition by two ways:
- using Websocket API
- using REST API
Interaction using Websocket API¶
To get WCS stream information in realtime and to manage WCS monitoring, STOMP based Websocket API can be used
Connecting to backend server via STOMP over Websocket¶
To connect to backend server, do the following:
-
Establish Secure Websocket connection to
https://hostname:8090/ws
, wherehostname
is backend server host name -
Establish STOMP connection by sending the message
-
Subscribe to
/alarms
queue for alarms receiving by sending the message
-
Subscribe to
/user/service
queue to receive responses to requests by sending the message
Requests sending and responses receiving¶
Requests should be sent as STOMP messages, for example
SEND
destination:/app/api/metric/list
content-length:100
{"requestId":"eb2c2807-8c2f-4418-aebe-03622404e4bb","realm":"/api/metric/list","payload":{"id":"3"}}^@
Where:
destination
- reqiuest URIcontent-length
- request body length
Request body is JSON object with te following parameters:
requestId
- unique request identifierrealm
- request method usedpayload
- request data depending on method used
Response will be received asynchronously in /user/service
queue as STOMP message, for example
MESSAGE
destination:/user/service
content-type:application/json;charset=UTF-8
subscription:sub-1
message-id:3-8
content-length:159
{"requestId":"eb2c2807-8c2f-4418-aebe-03622404e4bb","status":200,"reason":"SUCCESS","payload":[{"id":3,"name":"Video rate","note":"","enumName":"VIDEO_RATE"}]}^@
Where:
destination
- queue URIcontent-type
- content type (alwaysapplication/json
)subscription
- subscription identifiermessage-id
- message identifiercontent-length
- response body length
Response body is JSON object with te following parameters:
requestId
- unique request identifierstatus
- standard HTTP response statusreason
- response reason phrasepayload
- response data depending on request data and response status
Interaction using REST API¶
To receive WCS stream information and to manage WCS monitoring, REST API can be used
REST query should be HTTPS POST
request as follows:
https://wcsoam.flashphoner.com:8090/api/stream/history
Здесь:
wcsoam.flashphoner.com
- backend server address8090
- HTTPS port/api/stream/history
- REST method used
Connection setup¶
Port configuration¶
HTTPS port to handle REST queries and WSS connections can be set with the following parameter in wcsoam.properties
file
Websocket connection timeout configuration¶
Websocket connection timeout is set with the following parameter in wcsoam.properties
file
CORS configuration¶
Cross-domain requests should be allowed to establish connection from browser with the following parameter in wcsoam.properties
file