From 0ad4cd4f7ea4ee7ce85e2c6abfb1385bcac680c6 Mon Sep 17 00:00:00 2001 From: Grant Date: Tue, 2 Jul 2024 17:57:07 -0600 Subject: [PATCH] add reconnect debug lines --- packages/client/src/lib/network.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/packages/client/src/lib/network.ts b/packages/client/src/lib/network.ts index 8349771..b10b065 100644 --- a/packages/client/src/lib/network.ts +++ b/packages/client/src/lib/network.ts @@ -44,6 +44,7 @@ class Network extends EventEmitter { { autoConnect: false, withCredentials: true, + reconnection: true, } ); private online_count = 0; @@ -72,6 +73,22 @@ class Network extends EventEmitter { this.emit("disconnected"); }); + this.socket.io.on("reconnect", (attempt) => { + console.log("Reconnected to server on attempt " + attempt); + }); + + this.socket.io.on("reconnect_attempt", (attempt) => { + console.log("Reconnect attempt " + attempt); + }); + + this.socket.io.on("reconnect_error", (err) => { + console.log("Reconnect error", err); + }); + + this.socket.io.on("reconnect_failed", () => { + console.log("Reconnect failed"); + }); + this.socket.on("user", (user: AuthSession) => { this.emit("user", user); });