The example in the Socket.io Chat Example reading allows its users to send messages to each other.
Listening on *: 3000
To send a message to everyone except the sender, you would use
socket.broadcast.emit
A room is a socket channel.
By using
socket.join
By calling the
disconnect
event
A namespace is a specific chanmnel that lets you split the logic of the application and allows for
multiplexing
Event Handler
,room
, andmiddleware
.
One possible use case for using separate namespaces is if we want to create seperate “rooms/channels” that have restricted access.