Complete the code to send a message to all clients in a specific room.
io.to('[1]').emit('message', 'Hello room!');
The to method targets a specific room by its name, here 'room1'.
Complete the code to join a client socket to a room named 'chatroom'.
socket.[1]('chatroom');
The join method adds the socket to the specified room.
Fix the error in broadcasting a message to all clients except the sender.
socket.[1].emit('message', 'Hello everyone!');
The broadcast property sends to all clients except the sender.
Fill both blanks to broadcast a message to a specific room excluding the sender.
socket.[1].to('[2]').emit('message', 'Hi room!');
Use socket.broadcast.to('room1') to send to all in 'room1' except the sender.
Fill all three blanks to create a dictionary of room names and their client counts.
const counts = { [1]: await io.in('[2]').allSockets().then(sockets => sockets.size), [3]: 0 };This code counts clients in 'roomA' and initializes 'roomB' count to zero.
