1

I build a project using sails.js , I have a request http://localhost:8005/auditAllUsers , which take above 2mins to get response back. I saw ERR_EMPTY_RESPONSE in chrome network .

I did some research , know how to do in nodejs with expressjs config

var express = require('express');
var app = express();
app.get('/', function(req, res){
    console.log('incoming');
    setTimeout(function(){
        res.send('hello world');},
    3000);//4000
});
var server = app.listen(3000, function(){
    console.log('ready at 3000');
});

server.on('connection', function(socket) {
  console.log("A new connection was made by a client.");
  socket.setTimeout(4 * 1000); 

})

I read some article , know that default timeout is: 2mins.

and some git project may help, somehow I'm using sailsjs, these git project may not be helpful.

and saw sails config doc , and put them in app.js:

sails.config.hookTimeout = 5000;
console.log('set hookTimeout');
// Start server
sails.lift(rc('sails'));

but have no luck.

and tried according to sails socket docin config/socket.js:

onConnect: function(session, socket) {
    console.log("A new connection was made by a client.");
    socket.setTimeout(30 * 60 * 1000);
// By default, do nothing.

},

But the code did NOT log: console.log("A new connection was made by a client.");

So, what should I do with sails.js? Thanks in advance.

2
  • Did you manage to solve this problem? Commented Dec 2, 2015 at 10:58
  • 1
    This timeout is only for hooks timeout configurations, not http connection timeout, they are 2 different things Commented Dec 23, 2015 at 21:46

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.