How to disconnect all sockets serve side using socket.io? -


how can disconnect/close sockets on server side ?

maybe restarting socket.io module server side ?

(using lateste socket.io)

assuming io socket.io server object, can server-side disconnect connected clients:

io.sockets.sockets.foreach(function(s) {     s.disconnect(true); }); 

depending upon client configuration, clients may try reconnect.


fyi, there lot of different answers similar problems in question: socket.io - how list of connected sockets/clients?, have pay attention answers apply socket.io versions greater 1.0 since changed v1.0.


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -