1

In node js, Socket Timeout by default has been set for Two Minutes in the package itself which i found in the documentation. I want the location where this code is lying inside the package so that i can modify them.

I found the following alternate solution but I want it to be changed in the core library.

var serverInstance = http.createServer(app).listen(port, function(){
   // code 
}
serverInstance.timeout = 0;   // for disabling the timeout 

serverInstance.on('timeout', function(socket){
   // custom code 
});

For your Reference: 1.) Express.js is the server API 2.) connect.js is the session management API

1 Answers1

1

The socket timeout is set by calling socket.setTimeout. When a socket is assigned to a server, the server triggers a 'socket' event.

So, you should be able to find out where the libraries you're using override the socket timeout. If they don't expose this as an option, you could override Socket.prototype.setTimeout to ensure that only the timeout you want is set.

Trevor Burnham
  • 76,828
  • 33
  • 160
  • 196