blob: 9f88b481741c63d2e08e01df6607f0ee3d7e6c6c (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
|
import { CLOSECODES } from "./Constants";
import WebSocket from "./WebSocket";
// TODO: make heartbeat timeout configurable
export function setHeartbeat(socket: WebSocket) {
if (socket.heartbeatTimeout) clearTimeout(socket.heartbeatTimeout);
socket.heartbeatTimeout = setTimeout(() => {
return socket.close(CLOSECODES.Session_timed_out);
}, 1000 * 45);
}
|