From b4edb347eaf27efdf91f467426ad02fba61a4d57 Mon Sep 17 00:00:00 2001 From: Aniket Divekar Date: Tue, 3 Sep 2024 21:59:46 +0530 Subject: [PATCH] added keep alive config on connection --- src/server.ts | 1 + 1 file changed, 1 insertion(+) 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()