Control Stream Protocol

The control stream protocol allows the clients and the server to exchange control information to setup the data streams. The protocol is based on basic JSON strings that get exchanged. When to contol port is connected the client has to authenticate to get a token. With this token client intitated functions can be submitted to the server. The server has also the option to initiate communication with the client to update the client about changes in contol functionality or to initiate a disconnect.

Control stream

The control stream can me used in two different protocol types

  • TCP
  • WSS (web socket secure)

The TCP control stream is not encrypted at the moment, but could be in future versions. However, the websocket secure (WSS) control stream is encrypted and is the prefered method to connect to the server.

Client initiated control functions

When the client wants to connect to the server or manage streams it can start the communication with the server.

Basic function

All client initiated communication the control channel has the following basic data format:

Request from client
{
  "ID": number,                         - the ID is a tag that the server echos
                                          back to the client. In this way the
                                          client knwos which request and answer is for
  "function"(string):"functionname",    - identify a function to run
  "parameter1*":"",                     - parameters of the function
  "parameter2*":"",                       parameter names and types can be 
  "parameterN*":""                        freely selected for each function
}
Response from server
{
  "ID": number,                 - the ID that was supplied in the request
  "response1*":"",              - response of the function
  "response2*":"",                response names and types can be 
  "response"*:"",                 freely selected for each function  
  "statuscode"(integer):XXX,    - status code of the function
  "message"*:""                 - optional status description
}

Functions cannot return a reponse with a variable 'function', since it is reserved for server initiated functions.

Server initiated control functions

The server can initiate functions on the control channel (rather than the client initiating them).

Basic function

All modules that communicate on the control channel will have the following basic data format:

Request from server
{
  "function"(string):"functionname",    - identify a function to run
  "parameter1*":"",                     - parameters of the function
  "parameter2*":"",                       parameter names and types can be 
  "parameterN*":""                        freely selected for each function
}
Response from client
{
  "response1*":"",                      - response of the function
  "response2*":"",                        response names and types can be 
  "response"*:"",                         freely selected for each function  
  "statuscode"(integer):XXX,            - status code of the function
  "message"*:""                         - optional status description
}