user3182138
user3182138

Reputation:

Various questions about io.sockets.manager and join functions of Socket.io

I have some questions regarding Socket.io and could not find any answer for following terms/functions/whatever of Socket.io. These are used in hundreds of examples to create chat system but none of them has clearly defined what these terms do.

  1. what does io.sockets.manager do?
  2. what does io.sockets.join() do?
  3. can client.leave() be used to to leave some joint room? or what?

And another question is that if I have created Rooms array which holds ids of different rooms. Now how can I send message to only particular room? Suppose

var Rooms = [ 
   { 'a' : 'Room1' }, 
   { 'b' : 'Room2' }, 
   { 'c' : 'Room3' }
]

How can I send message to Rooms['a'] only? Like to send msg to all, it's just:

io.sockets.emit('server_says', { msg: 'Hello All'});

Where can I find some article where all such functions like join(), manager etc are found with their details?

Please if possible provide some code so I can understand better.

Upvotes: 1

Views: 2860

Answers (1)

Related Questions