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;