From the course: Node.js: Real-Time Web with Socket.IO
Unlock the full course today
Join today to access over 24,600 courses taught by industry experts.
Introduction and namespace setup
From the course: Node.js: Real-Time Web with Socket.IO
Introduction and namespace setup
- [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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.