diff --git a/packages/node_modules/@node-red/nodes/core/network/10-mqtt.js b/packages/node_modules/@node-red/nodes/core/network/10-mqtt.js index 3b2a17cdd..901fc9819 100644 --- a/packages/node_modules/@node-red/nodes/core/network/10-mqtt.js +++ b/packages/node_modules/@node-red/nodes/core/network/10-mqtt.js @@ -1005,19 +1005,14 @@ module.exports = function(RED) { node.on('close', function(done) { node.disconnect(function() { - if(node.client) { - node._clientRemoveListeners(); - } done(); }); }); - // Helper functions to track the event listners we add to the - // client. The mqtt client also uses it own set of listeners - // so we can't use removeAllListeners() wothout breaking it - /** - * Add an event handler to the MQTT.js client + * Add event handlers to the MQTT.js client and track them so that + * we do not remove any handlers that the MQTT client uses internally. + * Use {@link node._clientRemoveListeners `node._clientRemoveListeners`} to remove handlers * @param {string} event The name of the event * @param {function} handler The handler for this event */