improve observer mode and disconnect

This commit is contained in:
Brian Beck 2026-03-14 20:41:54 -07:00
parent 25b4a53a00
commit 78e791f763
39 changed files with 877 additions and 837 deletions

View file

@ -232,6 +232,9 @@ wss.on("connection", (ws) => {
ws.on("close", () => {
relayLog.info("Browser client disconnected");
// Clear retry state so we never auto-reconnect without a browser client.
lastJoinAddress = null;
retryCount = 0;
if (retryTimer) {
clearTimeout(retryTimer);
retryTimer = null;
@ -288,19 +291,6 @@ wss.on("connection", (ws) => {
break;
}
case "disconnect": {
relayLog.info("Disconnect requested");
if (retryTimer) {
clearTimeout(retryTimer);
retryTimer = null;
}
if (gameConnection) {
gameConnection.disconnect();
gameConnection = null;
}
break;
}
case "sendCommand": {
if (gameConnection) {
const authEvents = [