socket io tutorial - Broadcasting to all users - socket io android - socket io client



It is possible to send a message or data to all avaible connections. This can be achieved by first initializing the server and then using the Socket io object to find all sockets and then emit as you normally would emit to a single socket

var io = require('Socket io')(80) // 80 is the HTTP port
io.on('connection', function (socket) {
      //Callback when a socket connects
    );
io.sockets.emit('callbackFunction',data); 
click below button to copy the code. By Socket tutorial team

Related Searches to Broadcasting to all users