I wish to put a timeout on my responses. I tried the following:
var timeout = express.timeout // express v3 and below
app.use(timeout(120000));
app.use(haltOnTimedout);
function haltOnTimedout(req, res, next){
if (!req.timedout) next();
}
The problem is that there is some requests which are takes more then 120000 ms
(download of big files), and it fine. I want to timeout only requests that no information was transferred on the stream between my application (the server) and the client.
My code above closes all the connection which takes more then 120000 ms
.