Watch a demonstration of how to add a new namespace, which will be the basis of setting up rooms next.
- [Instructor] Namespace can get confusing…when someone first looks into it.…It may sound like you're creating…a different URL, but it's not.…You're basically within the same server,…creating separation that will be useful…when we get to work on rooms later.…So we are basically creating an internal endpoint…for socket.io to use for rooms.…An example, you could have a namespace called tech,…which includes all of our room related to tech,…such as JavaScript, HTML, and so on and so forth.…You could also add authorization…to namespace, where you can for rooms.…
So you could have people joining the tech namespace…with a login, and then have access…to only the tech rooms like JavaScript, et cetera.…So let's set up a namespace first.…So go into your server code, so the index.js,…and what I want you to do,…it's going to be very simple to create a namespace,…and I'm actually going to comment on it.…Tech namespace.…And you can create more than one namespace.…So basically, each namespace…is creating separation for our tech group.…
Released
12/5/2017- Coding the initial Express and Socket.IO server
- Coding front-end HTML
- Creating a chat with the emit function
- Setting up multiple rooms
- Coding new rooms within the namespace
- Setting up the Debug tool
- Emit cheatsheet
Share this video
Embed this video
Video: Introduction and namespace setup