0

I am now experimenting on node.js socket.io and trying to restart the socket.io server once it reach a specific number of connection. Below is my code so far but, really don't know how to execute the restart command.

var connectionsLimit = 100

io.on('connection', function (socket) {

  if (io.engine.clientsCount > connectionsLimit) {
    socket.emit('restart', { message: 'server will restart' })

    return
  }

 io.on('restart', function(data) {

    //how to restart?
 });

})
Sarotobi
  • 707
  • 1
  • 9
  • 28

0 Answers0