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

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -