Skip to Content
Building Scalable Apps with Redis and Node.js
book

Building Scalable Apps with Redis and Node.js

by Joshua Johanan
September 2014
Intermediate to advanced
316 pages
7h 6m
English
Packt Publishing
Content preview from Building Scalable Apps with Redis and Node.js

Using namespaces or rooms

We have now used both and can see that rooms and namespaces in Socket.IO are really similar. They are both ways of segmenting all the connections into groups. This leads us to the question, when do we use either of them?

Namespaces

JavaScript is a scripted language that executes in essentially one context. If you create a function in a different file (without using any module or closure system), it is created in the global scope. Identically named functions will overwrite each other. If you have used any strongly typed object-oriented language (C#.NET or Java are two examples), you will have seen and used namespaces. Namespaces in those languages allow you to create objects with the same name, but they would be separate ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Reactive Programming with Node.js

Reactive Programming with Node.js

Fernando Doglio
Node: Up and Running

Node: Up and Running

Tom Hughes-Croucher, Mike Wilson
Learn TypeScript 3 by Building Web Applications

Learn TypeScript 3 by Building Web Applications

Sebastien Dubois, Alexis Georges

Publisher Resources

ISBN: 9781783984480Supplemental Content