Skip to content

Commit

Permalink
added keep alive config on connection
Browse files Browse the repository at this point in the history
  • Loading branch information
aniketdivekar committed Sep 3, 2024
1 parent e84f038 commit b4edb34
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit b4edb34

Please sign in to comment.