简体   繁体   中英

Forever stops after few hours without any error

I Created one sockt.io application and running it using forever npm. Its working fine for few hours but after that its stops and there is no error in log file also.

I checked so many times and I am getting nothing.

Is there any issue in socket.io or forever.

Please help me

var app = require('express')();
var http = require('http').Server(app);
var io = require('socket.io')(http);

io.on('connection', function(socket){
  console.log('Server connected');
  //room connected
  socket.on('join', function(roomId){
    //join room
    socket.join(roomId);
  });

  //for new order
  socket.on('new_order', function(locationId){
    console.log("New order");
    socket.broadcast.to(locationId).emit('client_new_order', locationId);
  });
});

http.listen(3000, function(){
  console.log('listening on *:3000');
});

Check this

  forever start server.js // name of ur js file 

After you start the server the name of log will and path will be mentioned, if any errors, then they are placed in this log file .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM