Namespaces - evan-401-advanced-javascript/seattle-javascript-401d31 GitHub Wiki

Namespaces allow you to create custom endpoints and paths using socket.io. Custom name spaces can be setup using the of functions as shown below:

const nsp = io.of('/custom-name-space'); nsp.on('connection', function(socket){ console.log('someone connected'); }); nsp.emit('hi', 'everyone!');

For additional control rooms can be created using the join function to to enter a specific channel like so:

io.on('connection', function(socket){ socket.join('the best room'); });