The main bridge server. It is an EventEmitter
.
options
Object, contains:mqtt
Object, contains:host
String - hostname of MQTT serverport
Number - port MQTT server is listening on (default 1833)
websocket
Object - contains options for WebSocket server. The main one is:port
Number - the port to listen on for incoming WS connections
log4js
Object - contains options for log4js
Creates the bridge and begins listening on the port specified in options->websocket
.
Closes the bridge and terminates all clients
options
Object - contains the host, port and options to be passed to mqtt
Connects to the MQTT server, and returns the MQTT client.
function (error) { }
WebSocket server errors, forwarded from the ws
package
function (ws) { }
Incoming WebSocket connection. ws
is the WebSocket client.
function () { }
Closing the WebSocket server
WebSocket client class (see here)
function (err) { }
WebSocket client errors
function () { }
WebSocket client closing
function (message) { }
Incoming message over the WebSocket
MQTT Client class (see here)
function (err) { }
MQTT error
function () { }
MQTT client connected to server
function (topic, message, packet) { }
MQTT incoming message
topic
- message topicmessage
- message payloadpacket
- MQTT packet, containing:cmd
- MQTT command, e.g., 'publish'retain
- MQTT retain flagqos
- MQTT QOS for the messagedup
- Dup flaglength
- Message lengthtopic
- Message topicpayload
- Message payload
function () { }
MQTT client closed