node.js - What is the purpose of `socket.broadcast.to(param)` in socketio -
while i'm learning node.js, confronted example write chat system.
somewhere in code there's following line:
socket.broadcast .to(message.room) .emit('message', themessage);
i don't understand to
function doing. also, didn't find clue @ client side code. happens if code has not to(message.room)
part?
socket.broadcast.to broadcasts sockets in given room, except socket on called.
for more details : http://socket.io/docs/server-api/#socket#to(room:string):socket
Comments
Post a Comment