diff --git a/src/server.ts b/src/server.ts index 6b1c114c..fd91ec2c 100644 --- a/src/server.ts +++ b/src/server.ts @@ -54,6 +54,7 @@ const chainId = config.chainId //8080 const extendedServer = http.createServer(app) extendedServer.on('connection', (socket) => { + socket.setKeepAlive(true, 60000) // keep the connection to avoid unnecessary handshakes every time socket.setTimeout(20000) // close connection after 20s of inactivity socket.on('timeout', () => { socket.end()