I tried to use official demo in socket.io.
In this demo, it gives two arguments for connection callback.first is id,second is msg.but actually in function(id, msg)
, i tried and find out that the id is still the message,not id actually. why?
io.on('connection', function(socket){
socket.on('say to someone', function(id, msg){
socket.broadcast.to(id).emit('my message', msg);
});
});