fix(desktop): actually close relay sockets — plugin:websocket|disconnect does not exist (#1481)

Signed-off-by: Wes <wesbillman@users.noreply.github.com>
Co-authored-by: Brain <21994759fc7a6fa6b965551d35cfd7897d262f2495467f2d78694ddcfa6a5c7e@sprout-oss.stage.blox.sqprod.co>
This commit is contained in:
Wes
2026-07-02 16:55:53 -06:00
committed by GitHub
parent 3e282a2418
commit e70dd1a1e7
6 changed files with 117 additions and 22 deletions

View File

@@ -34,6 +34,7 @@ import {
shouldScheduleReconnect,
} from "@/shared/api/relayReconnectPolicy";
import { RelayStallWatchdog } from "@/shared/api/relayStallWatchdog";
import { closeWebSocket } from "@/shared/api/relayWebSocketClose";
import { buildThreadReferenceTags } from "@/features/messages/lib/threading";
const RECONNECT_BASE_DELAY_MS = 1_000,
@@ -114,9 +115,7 @@ export class RelayClient {
this.connectionStateEmitter.set("idle");
if (this.wsId !== null) {
void invoke("plugin:websocket|disconnect", { id: this.wsId }).catch(
() => {},
);
void closeWebSocket(this.wsId, "workspace switch");
this.wsId = null;
}
@@ -981,11 +980,7 @@ export class RelayClient {
}
if (this.wsId !== null) {
void invoke("plugin:websocket|disconnect", { id: this.wsId }).catch(
(err) => {
console.warn("[RelayClientSession] disconnect failed:", err);
},
);
void closeWebSocket(this.wsId, "connection reset");
}
this.wsId = null;