Tutorials References Exercises Videos Pro NEW Menu
Paid Courses Website NEW

Node.js server.timeout Property

❮ HTTP Server


Example

Get, and set, the number of milliseconds of inactivity before a connection should be considered timed out:

var http = require('http');
var srvr = http.createServer(function (req, res) {
  res.write('Hello World!');
  res.end();
});
srvr.listen(8080);
console.log(srvr.timeout);
srvr.timeout = 2000;
console.log(srvr.timeout);
Run example »

Definition and Usage

The server.timeout property sets, or gets, the server's timeout value, in milliseconds. Default is 2 minutes (120000 milliseconds)

Set the server.timeout property to 0 to avoid having a default timeout value.


Syntax

Get:

server.timeout;

Set:

server.timeout = number;

Technical Details

Return Value: A Number, representing the timeout value, in milliseconds
Node.js Version: 0.9.12

❮ HTTP Server