ES7 classes

As we discussed in the last chapter, we have our socket join listener but the problem is that the information inside the listener. It gets lost once the callback is complete, things like the username and the room name, they are not persisted anywhere. We're going to need that information to complete our event listeners. createMessage is going to need to know the user's name as well as the room name to send that message to the specific room, and same is the case with createLocationMessage. We'll discuss that in this chapter.

We'll start with learning the ES6 class syntax and using it in creating users class and some other methods. We'll also see wiring up the users list, updating the people list when any user joins or leaves the ...

Get Advanced Node.js Development 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.