socket.io Broadcasting to all users


Example

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);