Within each namespace, you can have many rooms that can be joined or left
io.on('connection',function(socket){socket.join('some room');});//And then simply use to or in (they are the same) when broadcasting or emitting:io.to('some room').emit('some event');
To leave a channel you call leave in the same fashion as join. Both methods are asynchronous and accept a callback argument.
Server/Client Usage
Server
Setuping up with express generator's bin/www is a little tricky
Require this file to access the right fts in the routes
bin/www
let server =http.createServer(app);constio=socketApi.io;io.attach(server);
Client
import io from'socket.io-client';//by default connects to server that served it, 1st arg is the route to connect onconstsocket=io(); socket.on("message", evt => {console.log("Recieved Msg", evt);socket.emit("message", evt);});