24 lines
		
	
	
		
			805 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			24 lines
		
	
	
		
			805 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| "use strict";
 | |
| Object.defineProperty(exports, "__esModule", { value: true });
 | |
| const log = require("./log");
 | |
| const mqtt = require("./mqttclient");
 | |
| class Dispatcher {
 | |
|     constructor() {
 | |
|         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);
 | |
|         this._mqttClient.register('IoT/Device/#', mqtt.passThrough);
 | |
|     }
 | |
|     exec() {
 | |
|         log.info("Dispatcher starting");
 | |
|         this._mqttClient.exec();
 | |
|         log.info("Dispatcher running");
 | |
|     }
 | |
| }
 | |
| const dispatcher = new Dispatcher();
 | |
| dispatcher.exec();
 | |
| //# sourceMappingURL=main.js.map
 | 
