1
0
mirror of https://github.com/node-red/node-red-nodes.git synced 2023-10-10 13:36:58 +02:00

Fix multiple mqlight node subscriber issue

This commit is contained in:
Nick O'Leary 2015-06-09 10:07:11 +01:00
parent d515deece1
commit cfb8ab7e92
2 changed files with 13 additions and 11 deletions

View File

@ -62,18 +62,20 @@ module.exports = function(RED) {
var recvClient = node.serviceConfig.client; var recvClient = node.serviceConfig.client;
recvClient.on("started", function() { recvClient.on("started", function() {
recvClient.on("message", function(data, delivery) { recvClient.on("message", function(data, delivery) {
var msg = { if (node.topic === delivery.destination.topicPattern) {
topic: delivery.message.topic, var msg = {
payload: data, topic: delivery.message.topic,
_session: { payload: data,
type: "mqlight", _session: {
id: recvClient.id type: "mqlight",
id: recvClient.id
}
};
if (delivery.destination.share) {
msg.share = delivery.destination.share;
} }
}; node.send(msg);
if (delivery.destination.share) {
msg.share = delivery.destination.share;
} }
node.send(msg);
}); });
recvClient.on("error", function(err) { recvClient.on("error", function(err) {
if (err) { if (err) {

View File

@ -1,6 +1,6 @@
{ {
"name" : "node-red-node-mqlight", "name" : "node-red-node-mqlight",
"version" : "0.0.6", "version" : "0.0.7",
"description" : "A Node-RED node to send and receive message from IBM MQ Light", "description" : "A Node-RED node to send and receive message from IBM MQ Light",
"dependencies" : { "dependencies" : {
"mqlight" : "1.0.x" "mqlight" : "1.0.x"