FIX: the server now closes the socket after 30s of no pong
This commit is contained in:
parent
a14e227706
commit
85f2dabe6c
3 changed files with 16 additions and 2 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue