We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ad13293 commit 377b3d6Copy full SHA for 377b3d6
src/client/Websocket.ts
@@ -17,6 +17,8 @@ export class WebsocketClient extends EventEmitter {
17
private getToken: () => Promise<WebsocketAuthData>
18
) {
19
super();
20
+ // Allow 100 listeners for this instance
21
+ this.setMaxListeners(100);
22
this.updateToken = ((
23
getToken: () => Promise<WebsocketAuthData>,
24
socket: WebsocketClient
@@ -71,6 +73,11 @@ export class WebsocketClient extends EventEmitter {
71
73
private connect(url: string): this {
72
74
this.url = url;
75
76
+ // Close socket if needed
77
+ if (this.socket?.ws.OPEN) {
78
+ this.socket.close();
79
+ }
80
+
81
this.socket = new Socket(this.url, {
82
onmessage: (e) => {
83
try {
0 commit comments