The WebSocket plugin creates a websocket server on the given ip address and port.
The default behaviour is to listen on all available network interfaces on port 5005.
When two or more websocket plugins are initialises, a different port must be specified,
the instances from 2 upwards will error out.
A server name can be specified with the options/server_name parameter. This defaults to ‘dcontrol’.
SSL handshaking is nog supported by the plugin. It’s intended use is that it will be proxied by a
webserver, e.g. NGINX which will terminate the SSL encryption.
The json schema defines a custom json schema to be used for sending and receiving data.
By default, the following schema is used:
{
"dcontrol": {
"data": {
"%PLACEHOLDER%"
}
}
}
The placeholder gets replaced with the key’s and values defined in the mapping settings.
The end result will then look like:
{
"dcontrol": {
"data": {
"key1": "value1",
"key2": "value2"
}
}
}
Also, “dcontrol” is replaced by the options/server_name value if it is defined.
When sending data the entire structure is honored and send over, data send to the
websocket must mach the structure, but can omit the additional key/value pairs.
Make sure that the value in the yaml file is valid json, so using double quotes
for the keys and string values, the entire
string should then be surrounded with single quotes to make it valid yaml.