Creating namespaces

Socket.IO has another trick up its sleeve. We have been working in only one area so far, but Socket.IO has methods to connect to multiple areas. The first is namespaces. The other is rooms. Both of these ideas are very similar, and we will set both of them up.

We will use the same idea of users being able to ping, but we will add onto this idea. First of all, we will allow users to enter different areas and ping inside those areas. Secondly, we will allow users to send private pings that will only go to one specific user. For this, we will create a new project and start from scratch. We will use namespaces for the first project.

Here is all the boilerplate code that we need to do. Create a directory named second app, files named ...

Get Building Scalable Apps with Redis and Node.js now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.