diff --git a/src/node/server.js b/src/node/server.js index 65772ff..20265e9 100644 --- a/src/node/server.js +++ b/src/node/server.js @@ -57,8 +57,13 @@ function initApp({ ws.binaryType = 'arraybuffer' + const pingInterval = setInterval(() => { + ws.ping() + }, 20 * 1000) + ws.on('close', () => { sockets.delete(ws) + clearInterval(pingInterval) }) ws.on('message', (rawData) => {