FIX: the server now closes the socket after 30s of no pong
This commit is contained in:
@@ -47,4 +47,13 @@ export function emitError(Client: ExSocketInterface, message: string): void {
|
||||
Client.send(serverToClientMessage.serializeBinary().buffer, true);
|
||||
}
|
||||
console.warn(message);
|
||||
}
|
||||
}
|
||||
|
||||
export const pongMaxInterval = 30000; // the maximum duration (in ms) between pongs before we shutdown the connexion.
|
||||
|
||||
export function refresLogoutTimerOnPong(ws: ExSocketInterface): void {
|
||||
if(ws.pongTimeout) clearTimeout(ws.pongTimeout);
|
||||
ws.pongTimeout = setTimeout(() => {
|
||||
ws.close();
|
||||
}, pongMaxInterval);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user