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

View File

@ -7,13 +7,13 @@ class Dispatcher {
constructor() {
this._mqttClient = new mqtt.MqttClient()
this._mqttClient.register('IoT/test', (message: any) : any => {
this._mqttClient.register('IoT/test', 'print', (message: any) : any => {
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() : void {