mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Only unsub mqtt node that is being removed
This commit is contained in:
parent
6a6d13b075
commit
073f38c68c
@ -421,9 +421,12 @@ module.exports = function(RED) {
|
|||||||
else {
|
else {
|
||||||
this.error(RED._("mqtt.errors.not-defined"));
|
this.error(RED._("mqtt.errors.not-defined"));
|
||||||
}
|
}
|
||||||
this.on('close', function(done) {
|
this.on('close', function(removed, done) {
|
||||||
if (node.brokerConn) {
|
if (node.brokerConn) {
|
||||||
|
if (removed) {
|
||||||
|
// This node has been removed so remove any subscriptions
|
||||||
node.brokerConn.unsubscribe(node.topic,node.id);
|
node.brokerConn.unsubscribe(node.topic,node.id);
|
||||||
|
}
|
||||||
node.brokerConn.deregister(node,done);
|
node.brokerConn.deregister(node,done);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user