You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In a case where the network connection is disconnected and MqttClient.end() is called like so:
varclient=mqtt.connect(/*...*/);// disconnect the network adapter...// the 'close' event is fired by the client (after a failed keepalive ping for example)// try to force close the client now:client.end(true,function(){// something to do within the callback});
The callback will never be called because the stream that is being destroyed in Client._cleanUp() here will never fire either a close or an error event unless an error is passed as an argument to stream.destroy()
Does that mean a user should not rely on the callback when calling end() with force set to true?
note: the close event from the socket that is forwarded by the client has already been emitted correctly - maybe I should not call end() after receiving a close event? what's the recommended usage pattern here?
Happy to submit a PR if you think the error should be emitted and the callback should be called.