fix: multiple bug fixes

isolated users, db backup, weird disconnect issues for long voice sessions,
This commit is contained in:
2026-04-24 22:19:57 +02:00
parent 44588e8789
commit bc2fa7de22
56 changed files with 1861 additions and 133 deletions

View File

@@ -67,6 +67,14 @@ describe('server websocket handler - status_update', () => {
connectedUsers.clear();
});
it('treats signaling keepalive messages as connection liveness', async () => {
createConnectedUser('conn-1', 'user-1', { lastPong: 1 });
await handleWebSocketMessage('conn-1', { type: 'keepalive' });
expect(connectedUsers.get('conn-1')?.lastPong).toBeGreaterThan(1);
});
it('updates user status on valid status_update message', async () => {
const user = createConnectedUser('conn-1', 'user-1');

View File

@@ -293,7 +293,13 @@ export async function handleWebSocketMessage(connectionId: string, message: WsMe
if (!user)
return;
user.lastPong = Date.now();
connectedUsers.set(connectionId, user);
switch (message.type) {
case 'keepalive':
break;
case 'identify':
handleIdentify(user, message, connectionId);
break;

View File

@@ -17,6 +17,6 @@ export interface ConnectedUser {
connectionScope?: string;
/** User availability status (online, away, busy, offline). */
status?: 'online' | 'away' | 'busy' | 'offline';
/** Timestamp of the last pong received (used to detect dead connections). */
/** Timestamp of the last pong or client message received (used to detect dead connections). */
lastPong: number;
}