Explain to a non-technical recruiter what the Chat Example (above) does.
The server can push messages to clients. Whenever you write a chat message, the idea is that the server will get it and push it to all other connected clients.
What proof of life are we getting on the backend from the above app?
“Hello world” should show up on local host 3000.
Socket.IO gives us the i0.emit() method to send an event to everyone. What flag would you use if you want to send a message to everyone except for a certain emitting socket?
broadcast flag
Rooms
What is a room and how might a room be useful?
A room is an arbitrary channel that sockets can join and leave. It can be used to broadcast events to a subset of clients.
How do you join a room?
socket.join("some room")
How do you leave a room?
socket.leave("some room")
Namespaces
What is a namespace and what does it allow you to do?
A namespace is a way to separate sockets into different groups. It allows you to segment the users by purpose or function.
Each namespace potentially has its own _______? (hint: 3 things)
Each namespace potentially has its own default room, connection event, and disconnect event.
Discuss a possible use case for separate namespaces.
A possible use case for separate namespaces is to separate the users by purpose or function. ie. you could have a namespace for the chat room and a namespace for the game room.