From 5c96d0f69a8f60a34ba630f4cf37256fb4c7f5aa Mon Sep 17 00:00:00 2001 From: Yurii Vlasiuk Date: Thu, 29 Nov 2018 13:03:53 +0200 Subject: [PATCH] Rename callback data to avoid upper scope reassign --- lib/transport/mqtt/MQTTTransportServer.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/transport/mqtt/MQTTTransportServer.js b/lib/transport/mqtt/MQTTTransportServer.js index 0f56a3c..7cc61b4 100644 --- a/lib/transport/mqtt/MQTTTransportServer.js +++ b/lib/transport/mqtt/MQTTTransportServer.js @@ -9,13 +9,13 @@ class MQTTTransportServer { await this.mqttClient.subscribe(this.inTopic); this.mqttClient.on('message', (topic, data) => { console.log(`SERVER RECEIVES ${topic}`, data.toString()); - callback(data.toString(), (data) => { + callback(data.toString(), (callbackData) => { const outTopic = typeof this.outTopic === "function" ? this.outTopic({inTopic: topic}) : this.outTopic; - this._send(outTopic, data) + this._send(outTopic, callbackData) }) }); } @@ -26,4 +26,4 @@ class MQTTTransportServer { } } -module.exports = MQTTTransportServer; \ No newline at end of file +module.exports = MQTTTransportServer;