24 lines
805 B
JavaScript
Raw Normal View History

2017-07-22 23:39:14 +02:00
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const log = require("./log");
2017-07-27 23:38:17 +02:00
const mqtt = require("./mqttclient");
2017-07-22 23:39:14 +02:00
class Dispatcher {
constructor() {
2017-07-27 23:38:17 +02:00
this._mqttClient = new mqtt.MqttClient();
this._mqttClient.register('IoT/test', (message) => {
log.info("Callback for IoT/test");
log.info(`message is ${message}`);
return `<<${message}>>`;
});
this._mqttClient.register('IoT/Device/#', mqtt.passThrough);
2017-07-27 23:58:14 +02:00
this._mqttClient.register('IoT/Device/#', mqtt.passThrough);
2017-07-22 23:39:14 +02:00
}
exec() {
log.info("Dispatcher starting");
this._mqttClient.exec();
2017-07-23 22:55:05 +02:00
log.info("Dispatcher running");
2017-07-22 23:39:14 +02:00
}
}
const dispatcher = new Dispatcher();
dispatcher.exec();
//# sourceMappingURL=main.js.map