Forward the events of a connection
using the provided client
. Also
forward the events of the provided client
to the connection
.
Example
var net = require('net');
var server = net.createServer();
var Adapter = require('strong-pubsub-mqtt');
var client = new Client('mqtt://my.mosquitto.org', Adapter);
var Connection = require('strong-pubsub-connection-mqtt');
server.on('connection', function(connection) {
var mqttConnection = new Connection(connection);
var bridge = new Bridge(mqttConnection, client);
});
Name | Type | Description |
---|---|---|
connection |
Connection
|
The |
client |
Client
|
The |
hooks |
Object[]
|
An array hook objects. |
Add a hook
function before the given action
is executed.
Name | Type | Description |
---|---|---|
action |
String
|
Must be one of the following:
|
hook |
Function
|
The function to be called before the action. Example:
Action Context The Action:
Action:
Action:
Event: Emitted with a
|
Connect the bridge to the broker using the provided client
and connection
.