Watch a demonstration of how to code a new room within the namespace and then connect any new client joining the room.
- [Instructor] Now that we have a namespace ready…to add rules to it, let's go ahead…and add a JavaScript room our tech namespace.…So the first thing you want to do…is, again, go inside of our client,…so index.html, and we want to go…at the top of our script here and add a variable.…So the variable is called room,…and the value you want to to it…is javascript like so.…So once you have the variable room created,…we need to pass it to a few things.…
So the first thing I want to do…is pass it to the emit message…once we connect here,…and instead of emitting a message,…we're going to emit a join event,…and the join event will actually pass…the room to it.…So on connection we're going to change…the event to a join event,…and we'll use it in the server after.…And we want to pass the room as the data,…so basically you'll do room dot room.…
So I know that if you want to do ES6 syntax,…you can just do room, but let's,…for the sake of making sure you guys understand…what we're doing, we keep it that way.…Okay, so once we have the emit,…
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 to rooms and setup