Skip to content

Commit

Permalink
Vary api call based on share
Browse files Browse the repository at this point in the history
  • Loading branch information
knolleary committed Oct 10, 2014
1 parent 1d39e93 commit f2d19d5
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions mqlight/mqlight.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,19 @@ module.exports = function(RED) {
node.send(msg);
});
node.log("Subscribing to "+node.topic+(node.share?+" ["+node.share+"]":""));
node.log("Node share: ["+node.share+"]");
recvClient.subscribe(node.topic, node.share, function(err) {
var subscribeCallback = function(err) {
if (err) {
node.error("Failed to subscribe: " + err);
} else {
node.log("Subscribed to "+node.topic+(node.share?+" ["+node.share+"]":""));
}
});
};

if (node.share) {
recvClient.subscribe(node.topic, node.share,subscribeCallback);
} else {
recvClient.subscribe(node.topic,subscribeCallback);
}
}
});
node.on("close", function (done) {
Expand Down

0 comments on commit f2d19d5

Please sign in to comment.