Reading notes about code for my future reference.
This is an example of a client and a server. But lets just put it as a post office and mail man. The office gives the mail man directions and he abides by those and the post office looks for confirmations and replies. The communcation is what socket.io handles.
When a server is started, connections and disconnection notices.
socket.to is the flag used to omit!
They are channels that sockets and connect and disconnect multiple connect. Great for having multiple pathways for communication.
io.on(“connection”, (socket) => { socket.join(“some room”); });
io.on(“connection”, socket => { socket.on(“disconnecting”, () => { console.log(socket.rooms); // the Set contains at least the socket ID });
socket.on(“disconnect”, () => { // socket.rooms.size === 0 }); });
What is a Namespace and what does it allow you to do?
A Namespace is a communication channel that allows you to split the logic of your application over a single shared connection also called “multiplexing”.
Events Handlers
Room
Middlewares
Make it where only authorized users have access to a seperate namespace with it’s own individual roles and such.ls