fix: WebSocket heartbeat to prevent idle drops + debounce reconnect sound

30s ping/pong keepalive prevents proxy/NAT from killing idle connections.
Reconnect sound now only plays if downtime exceeds 3s, suppressing phantom
audio from brief network blips.
This commit is contained in:
Jannis Braun
2026-02-23 19:45:32 +01:00
parent edcdf8b207
commit 77c5bda1fd
4 changed files with 38 additions and 3 deletions
+6
View File
@@ -604,6 +604,12 @@ export async function registerWebSocket(app: FastifyInstance): Promise<void> {
return;
}
// Fast-path heartbeat — never reaches business logic
if (parsed.type === 'ping') {
ws.send(JSON.stringify({ type: 'pong' }));
return;
}
// Handle authenticated events
if (userId && username) {
handleClientEvent(parsed, userId, username);