Skip to content

Websockets

Jean-Michel DECORET edited this page Jan 19, 2016 · 2 revisions

Presentation

The web server can send async data with web client using websocket.

Main data goes like this are acquisition data from devices.

It permit to reduce the amount of data that goes from the server to the client. A data is given to the client only when there is a new one.

The client create a web socket on the same port than the webserver. The Server detect if it is a web connection or a websocket connection using the uri. Websocket use the address : ws://127.0.0.1:8080/ws

Frames

Here is the list of data that can be found on the websocket. All frames are expressed in json format.

Acquisition update

This frame is sent from the server to the client to provide a new data. It is fired each time a device has sent a data that interest the client (see Filter Acquisition for more information).

{
   "type" : "acquisitionUpdate",
   "data" : {
      "id" : "45785",
      "date" : "20140905T093856",
      "keywordId" : "2",
      "value" : "29.6"
   }
}

Acquisition filter

This frame is sent from the client to the server. It is used to set the filter to have notification of only needed keywords.

{
   "type" : "acquisitionFilter",
   "data" : [ 2, 5 ]
}

The data collection contains the list of all keywordId that are required. All other will not be pushed in the websocket.

If data collection is empty all keywordId will be sent to the client.

{
   "type" : "acquisitionFilter",
   "data" : []
}
Clone this wiki locally