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

Added manual device events, fixed MQTT publish filter.

This commit is contained in:
Ylian Saint-Hilaire 2019-10-16 14:46:41 -07:00
parent 1dc81b6c38
commit 4932d7961f
5 changed files with 44 additions and 3 deletions

View file

@ -126,8 +126,8 @@ module.exports.CreateMQTTBroker = function (parent, db, args) {
if (clients == null) return;
if (typeof message == 'string') { message = new Buffer(message); }
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 });
// Only publish to client that subscribe to the topic
if (clients[i].subscriptions[topic] != null) { clients[i].publish({ cmd: 'publish', qos: 0, topic: topic, payload: message, retain: false }); }
}
}