# Websocket plugins {#websocket_plugin}
Version: @PROJECT_VERSION@

The websocket sink and source plugins are designed to relay data between devices and
potentially to web pages.

To enable the websocket plugins, run cmake and enable the websocket_plugin option:

cmake -Dwebsocket_plugin=On ..

To use the websocket sink plugin, add the following to the "sinks" array in /etc/ambd/config:

~~~~~~~~~~~~~{.json}
{
	"name" : "websocket sink",
	"path" : "@PLUGIN_INSTALL_PATH@/websocketsink.so",
	"interface" : "lo",
	"useExtensions" : "true",
	"binaryProtocol" : "false",
	"ssl" : "false".
	"cert" : "libwebsockets-test-server.pem",
	"key" : "libwebsockets-test-server.key.pem"
}
~~~~~~~~~~~~~

To use the websocket source plugin, add the following to the "sources" array in /etc/ambd/config:

~~~~~~~~~~~~~{.json}
{
	"name" : "WebsocketSource",
	"path" : "@PLUGIN_INSTALL_PATH@/websocketsource.so",
	"port" : "23000",
	"ssl" : "false",
	"ip" : "192.168.1.40",
	"binaryProtocol" : "true",
	"useExtensions" : "true"
}
~~~~~~~~~~~~~

## Configuration Key Definitions:

"name"
name of plugin.

"path"
path to plugin on the filesystem.

"interface" (sink only)
interface device.  Usually "lo" for loopback or "eth0".

default: lo

"useExtensions"
Use built in libwebsocket extensions like zlib compression of frames

default: false

"binaryProtocol"
Use fast and efficient binary protocol instead of JSON.

default: false

"ssl"
Use ssl secure socket

default: false

"cert" (sink only)

path to ssl certificate

"key" (sink only)

path to ssl key

