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.

Community
  • 1
  • 1
no7dw
  • 505
  • 5
  • 13

0 Answers0