Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is difference between keepAliveTimeout and connection timeout. How can I check keepAliveTimeout in headers?

Is there any difference between keepAliveTimeout and connection timeout ? I am using node.js with express. I have specified timeout as follows:

const app = express();
app.listen(3000, '0.0.0.0', () => {
  console.log(`The server is running at http://localhost:3000/`);
});
app.on('connection', (socket) => {
  socket.setTimeout(60 * 1000);
});

Will above code change keepAliveTimeout ? In browser I am getting just Connection: keep-alive header in browser. How can I check keepAliveTimeout of my application ?

like image 929
Sudhanshu Srivastava Avatar asked Nov 06 '22 19:11

Sudhanshu Srivastava


1 Answers

Keep-Alive header can inform the client how long the server is willing to keep the connection open (timeout=N value) and how many requests you can do over the same connection (max=M) before the server will force a close of the connection.

Connection-TimeOut is when you request for connect and that takes mintue and don't get response so it give you Connection-TimeOut

like image 122
Narendra Chouhan Avatar answered Nov 14 '22 21:11

Narendra Chouhan