mirror of
https://github.com/Moepchi/webspeak3.git
synced 2026-12-03 01:42:50 +08:00
Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7357dfa85d | ||
|
|
ceeba24f86 | ||
|
|
817aa0f5f6 |
No files matched your search
+9
-7
@@ -25,13 +25,15 @@ This roadmap is intentionally outcome-focused. It does not promise fixed dates.
|
|||||||
does not document, so the wire format was derived from observed behavior and
|
does not document, so the wire format was derived from observed behavior and
|
||||||
may break with any TS6 update. Connection setup, picture quality, and viewer
|
may break with any TS6 update. Connection setup, picture quality, and viewer
|
||||||
admission are not yet dependable. The "Server" connection mode (TS6's SFU) is
|
admission are not yet dependable. The "Server" connection mode (TS6's SFU) is
|
||||||
not implemented; only direct P2P works. The UI is currently switched off by a
|
not implemented; only direct P2P works. The UI is gated by a build-time flag,
|
||||||
build-time flag, because the hosted client updates on every push while the
|
because the hosted client updates on every push while the gateway image is
|
||||||
gateway image is deployed by hand, and a browser that offers streaming to a
|
deployed by hand, and a browser that offers streaming to a gateway too old to
|
||||||
gateway too old to answer waits forever instead of reporting an error. The
|
answer waits forever instead of reporting an error — on since 2026-09-11 for
|
||||||
fix is a capability handshake so the client can detect what its gateway
|
client.webspeak3.de now that its gateway answers setupStream/joinStream/
|
||||||
supports rather than assuming; until then the flag is flipped by hand after
|
sendStreamSignal (v0.11.0-beta.1+). The durable fix is a capability handshake
|
||||||
the gateway has been updated.
|
so the client can detect what its gateway supports rather than assuming;
|
||||||
|
until then the flag is flipped by hand whenever the frontend gains a stream
|
||||||
|
feature the deployed gateway doesn't have yet.
|
||||||
- Safari and Mobile Safari audio/microphone behavior
|
- Safari and Mobile Safari audio/microphone behavior
|
||||||
- Uncommon TeamSpeak permission combinations and large permission sets
|
- Uncommon TeamSpeak permission combinations and large permission sets
|
||||||
- Very large servers and long-running browser sessions
|
- Very large servers and long-running browser sessions
|
||||||
|
|||||||
+45
-9
@@ -428,6 +428,17 @@ interface HeartbeatState {
|
|||||||
|
|
||||||
const heartbeats = new WeakMap<WebSocket, HeartbeatState>();
|
const heartbeats = new WeakMap<WebSocket, HeartbeatState>();
|
||||||
|
|
||||||
|
// Tracked so SIGTERM (below) can tell every live TS3/TeaSpeak session to
|
||||||
|
// disconnect properly before the process exits, instead of leaving the
|
||||||
|
// target server to notice on its own timeout.
|
||||||
|
const liveConnections = new Set<Ts3Connection>();
|
||||||
|
// Set right before that graceful disconnect: suppresses forwarding the
|
||||||
|
// connector's own "disconnected" event to the browser during shutdown, so
|
||||||
|
// the browser sees a raw socket close (which it auto-reconnects from) rather
|
||||||
|
// than an explicit disconnect (which it treats as deliberate and gives up
|
||||||
|
// on) — see the SIGTERM handler.
|
||||||
|
let shuttingDown = false;
|
||||||
|
|
||||||
const heartbeatTimer = setInterval(() => {
|
const heartbeatTimer = setInterval(() => {
|
||||||
for (const socket of wss.clients) {
|
for (const socket of wss.clients) {
|
||||||
const state = heartbeats.get(socket);
|
const state = heartbeats.get(socket);
|
||||||
@@ -448,16 +459,35 @@ wss.on("close", () => clearInterval(heartbeatTimer));
|
|||||||
// browser tab so an active call/stream doesn't just silently drop, then
|
// browser tab so an active call/stream doesn't just silently drop, then
|
||||||
// exit quickly rather than waiting out the grace period doing nothing.
|
// exit quickly rather than waiting out the grace period doing nothing.
|
||||||
process.on("SIGTERM", () => {
|
process.on("SIGTERM", () => {
|
||||||
const payload = JSON.stringify({ type: "notice", messageKey: "restartNotice.body" });
|
void (async () => {
|
||||||
for (const socket of wss.clients) {
|
const payload = JSON.stringify({ type: "notice", messageKey: "restartNotice.body" });
|
||||||
try {
|
for (const socket of wss.clients) {
|
||||||
socket.send(payload);
|
try {
|
||||||
} catch {
|
socket.send(payload);
|
||||||
/* socket already gone */
|
} catch {
|
||||||
|
/* socket already gone */
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
console.log(`[gateway] SIGTERM received, notified ${wss.clients.size} client(s), disconnecting ${liveConnections.size} live session(s)`);
|
||||||
console.log(`[gateway] SIGTERM received, notified ${wss.clients.size} client(s), shutting down`);
|
|
||||||
setTimeout(() => process.exit(0), 500);
|
// Tell every connector to leave its TS3/TeaSpeak server *before* the
|
||||||
|
// process exits. Without this, `docker stop`'s grace period expires and
|
||||||
|
// the container is killed, taking the connector child processes with it
|
||||||
|
// mid-session - the target server only notices via its own timeout
|
||||||
|
// (which can take a while), during which a client's automatic reconnect
|
||||||
|
// (see App.tsx's scheduleReconnect) gets rejected by the server as a
|
||||||
|
// duplicate identity (e.g. "ClientTooManyClonesConnected"). shuttingDown
|
||||||
|
// suppresses forwarding the resulting "disconnected" event to the
|
||||||
|
// browser - the browser must see a raw socket close here, not an
|
||||||
|
// explicit disconnect, or it treats it as deliberate and won't retry.
|
||||||
|
shuttingDown = true;
|
||||||
|
await Promise.race([
|
||||||
|
Promise.all([...liveConnections].map((c) => c.disconnect().catch(() => {}))),
|
||||||
|
new Promise((resolve) => setTimeout(resolve, 5000)),
|
||||||
|
]);
|
||||||
|
console.log(`[gateway] shutting down`);
|
||||||
|
process.exit(0);
|
||||||
|
})();
|
||||||
});
|
});
|
||||||
|
|
||||||
server.listen(PORT, () => {
|
server.listen(PORT, () => {
|
||||||
@@ -497,6 +527,7 @@ wss.on("connection", (socket: WebSocket) => {
|
|||||||
} catch {
|
} catch {
|
||||||
/* ignore */
|
/* ignore */
|
||||||
}
|
}
|
||||||
|
liveConnections.delete(connection);
|
||||||
connection = undefined;
|
connection = undefined;
|
||||||
}
|
}
|
||||||
const options: Ts3ConnectOptions = {
|
const options: Ts3ConnectOptions = {
|
||||||
@@ -510,7 +541,9 @@ wss.on("connection", (socket: WebSocket) => {
|
|||||||
privilegeKey: parsePrivilegeKey(msg),
|
privilegeKey: parsePrivilegeKey(msg),
|
||||||
};
|
};
|
||||||
connection = new Ts3Connection(options);
|
connection = new Ts3Connection(options);
|
||||||
|
liveConnections.add(connection);
|
||||||
connection.onEvent((event) => {
|
connection.onEvent((event) => {
|
||||||
|
if (shuttingDown) return;
|
||||||
if (LOG_CONNECTIONS) {
|
if (LOG_CONNECTIONS) {
|
||||||
if (event.type === "connected") {
|
if (event.type === "connected") {
|
||||||
console.log(
|
console.log(
|
||||||
@@ -777,6 +810,8 @@ wss.on("connection", (socket: WebSocket) => {
|
|||||||
}
|
}
|
||||||
case "disconnect": {
|
case "disconnect": {
|
||||||
await connection?.disconnect(msg.message ?? "");
|
await connection?.disconnect(msg.message ?? "");
|
||||||
|
if (connection) liveConnections.delete(connection);
|
||||||
|
connection = undefined;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@@ -788,6 +823,7 @@ wss.on("connection", (socket: WebSocket) => {
|
|||||||
|
|
||||||
socket.on("close", () => {
|
socket.on("close", () => {
|
||||||
heartbeats.delete(socket);
|
heartbeats.delete(socket);
|
||||||
|
if (connection) liveConnections.delete(connection);
|
||||||
connection?.disconnect();
|
connection?.disconnect();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
+1
-1
Submodule tsclientlib updated: 5914885e8a...6df8ba1bce.
Reference in new issue
Block a user