Skip to end of metadata
Go to start of metadata

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:

1. Establish Secure Websocket connection to https://hostname:8090/ws, where hostname is backend server host name

2. Establish STOMP connection by sending the message

CONNECT
accept-version:1.2
host:hostname

^@

3. Subscribe to /alarms queue for alarms receiving by sending the message

SUBSCRIBE
id:sub-0
destination:/alarm

^@

4. Subscribe to /user/service queue to receive responses to requests by sending the message

SUBSCRIBE
id:sub-1
destination:/user/service

^@

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 URI
  • content-length - request body length

Request body is JSON object with te following parameters:

  • requestId - unique request identifier
  • realm - request method used
  • payload - 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 URI
  • content-type - content type (always application/json)
  • subscription - subscription identifier
  • message-id - message identifier
  • content-length - response body length

Response body is JSON object with te following parameters:

  • requestId - unique request identifier
  • status - standard HTTP response status
  • reason - response reason phrase
  • payload - 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: https://wcsoam.flashphoner.com:8090/api/stream/history

Здесь:

  • wcsoam.flashphoner.com - backend server address
  • 8090 - 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

server.port = 8090

Websocket connection timeout configuration

Websocket connection timeout is set with the following parameter in wcsoam.properties file

stomp_max_timeout=1000

CORS configuration

Cross-domain requests should be allowed to establish connection from browser with the following parameter in wcsoam.properties file

access_control_allow_origin=*
  • No labels