add reconnect debug lines

This commit is contained in:
Grant 2024-07-02 17:57:07 -06:00
parent ed97f6648d
commit 0ad4cd4f7e
1 changed files with 17 additions and 0 deletions

View File

@ -44,6 +44,7 @@ class Network extends EventEmitter<INetworkEvents> {
{
autoConnect: false,
withCredentials: true,
reconnection: true,
}
);
private online_count = 0;
@ -72,6 +73,22 @@ class Network extends EventEmitter<INetworkEvents> {
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);
});