1
0
Fork 0
mirror of https://github.com/Ylianst/MeshCentral.git synced 2025-03-09 15:40:18 +00:00

Small MQTT improvement.

This commit is contained in:
Ylian Saint-Hilaire 2019-10-11 13:45:23 -07:00
parent 9d94a758cc
commit 4eecac6cce
4 changed files with 103 additions and 9 deletions

View file

@ -125,7 +125,10 @@ module.exports.CreateMQTTBroker = function (parent, db, args) {
var clients = obj.connections[nodeid];
if (clients == null) return;
if (typeof message == 'string') { message = new Buffer(message); }
for (var i in clients) { clients[i].publish({ cmd: 'publish', qos: 0, topic: topic, payload: message, retain: false }); }
for (var i in clients) {
// if (clients[i].subscriptions[topic] != null) { } // Add this if we only want to send subscribed topics.
clients[i].publish({ cmd: 'publish', qos: 0, topic: topic, payload: message, retain: false });
}
}
// Handle messages coming from clients