handle retained messages, introduc missing event detector

This commit is contained in:
Wolfgang Hottgenroth
2017-08-25 17:03:25 +02:00
parent 3967a6fb3a
commit 3309ba29e5
7 changed files with 173 additions and 26 deletions

View File

@ -60,8 +60,11 @@ class MqttDispatcher {
this.mqttClient.subscribe(topicHandler.topic);
}
});
this.mqttClient.on('message', (topic, payload) => {
this.mqttClient.on('message', (topic, payload, packet) => {
log.info(`message received, topic ${topic}, payload ${payload}`);
if (packet.retain) {
log.info("IS RETAINED");
}
for (let topicHandler of this.topicHandlers) {
if (this.topicMatch(topicHandler.topic, topic)) {
log.info(`received topic ${topic} matches registered topic ${topicHandler.topic}`);