fix: send localized connection failure details

This commit is contained in:
illusia committed 2026-09-13 08:00:07 +08:00
1 parent 7e08ee54a5
commit d13b3207a9
3 files changed
+40 -1

No files matched your search

+4
View File
@@ -449,6 +449,10 @@ export class VoiceBridge {
try {
if (session.state !== "disconnecting" && session.state !== "idle") session.transition("failed");
} catch { /* teardown below remains authoritative */ }
// Send the structured failure before closing. Some browsers and
// reverse proxies do not preserve a WebSocket close reason, which
// would otherwise collapse every failure into a generic message.
sendJson({ type: "connectionFailed", code: failureCode });
if (ws.readyState === WebSocket.OPEN) ws.close(4003, failureCode);
void this.teardown(entryId, "teamSpeak-connect-failed");
return;