From b5f689b0143717443f90a296cec2f690bbddc445 Mon Sep 17 00:00:00 2001 From: Zaid Humaimidi Date: Mon, 6 Feb 2023 14:48:00 -0800 Subject: [PATCH] Fix XMPP stream not getting closed properly --- lib/xmpp-client.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/xmpp-client.ts b/lib/xmpp-client.ts index 37b86d3..30320d0 100644 --- a/lib/xmpp-client.ts +++ b/lib/xmpp-client.ts @@ -383,7 +383,10 @@ export default class XmppClient extends EventEmitter { } close(): void { - this._socket.end(""); + this._socket.end(""); + this._socket.removeAllListeners("data"); + this._socket.removeAllListeners("error"); + this.emit("close"); } ref(): void {