From 1d9353c4bda5e9c9b1df6ab49562a0bf0d5ece54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9e=20Kooi?= Date: Thu, 14 May 2026 16:36:50 +0200 Subject: [PATCH 1/2] Emit a `user:join` on reconnection if we don't have a lost connection This prevented me from being able to log in locally, which might be a dev setup problem, and I'm not really confident that this is a _good_ fix. But, the only downside is possibly excess `user:join` messages, which we've always had and don't cause actual issues. --- src/SocketServer.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/SocketServer.js b/src/SocketServer.js index 20084409..4fcce357 100644 --- a/src/SocketServer.js +++ b/src/SocketServer.js @@ -552,11 +552,17 @@ class SocketServer { this.remove(connection); }); connection.on('authenticate', async ({ user, sessionID, lastEventID }) => { - const isReconnect = await connection.isReconnect(sessionID); + let isReconnect = await connection.isReconnect(sessionID); this.#logger.info({ userId: user.id, isReconnect, lastEventID }, 'authenticated socket'); if (isReconnect) { const previousConnection = this.getLostConnection(sessionID); - if (previousConnection) this.remove(previousConnection); + if (previousConnection) { + this.remove(previousConnection); + } else { + // If there's actually no lost connection, we might've derived the reconnection flag from stale state? + // XXX(@goto-bus-stop): validate this + isReconnect = false; + } } this.replace(connection, this.createAuthedConnection(socket, user, sessionID, lastEventID)); From 45c3a44cb1de55a969406f49d7567fe4940a3bf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9e=20Kooi?= Date: Thu, 14 May 2026 16:43:20 +0200 Subject: [PATCH 2/2] newline --- src/SocketServer.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/SocketServer.js b/src/SocketServer.js index 4fcce357..db005ac9 100644 --- a/src/SocketServer.js +++ b/src/SocketServer.js @@ -559,7 +559,8 @@ class SocketServer { if (previousConnection) { this.remove(previousConnection); } else { - // If there's actually no lost connection, we might've derived the reconnection flag from stale state? + // If there's actually no lost connection, we might've derived + // the reconnection flag from stale state? // XXX(@goto-bus-stop): validate this isReconnect = false; }