chaining of callbacks

This commit is contained in:
Wolfgang Hottgenroth
2017-07-29 00:26:29 +02:00
parent ac5566a402
commit 1aa7765079
4 changed files with 58 additions and 19 deletions

6
dist/main.js vendored
View File

@ -5,13 +5,13 @@ const mqtt = require("./mqttclient");
class Dispatcher {
constructor() {
this._mqttClient = new mqtt.MqttClient();
this._mqttClient.register('IoT/test', (message) => {
this._mqttClient.register('IoT/test', 'print', (message) => {
log.info("Callback for IoT/test");
log.info(`message is ${message}`);
return `<<${message}>>`;
});
this._mqttClient.register('IoT/Device/#', mqtt.passThrough);
this._mqttClient.register('IoT/Device/#', mqtt.passThrough);
this._mqttClient.register('IoT/Device/#', 'null1', mqtt.passThrough);
this._mqttClient.register('IoT/Device/#', 'null2', mqtt.passThrough);
}
exec() {
log.info("Dispatcher starting");