Wiring up createLoactionMessage for individual room

Now we're going to fix createLocationMessage. You're going to want to find the user just like we do above, incase of createMessage. If there is a user you're going to want to emit the location to just people in the same room. Instead of providing Admin as the name you're also going to want to use the user's real name. We need to make sure it still gets sent to users in the same room and make sure it does not get sent to users in other rooms.

To do this one, I am going to start by fetching the user since we are going to need to use the information on that object. We're going to make a variable user calling users.getUser, and we're going to pass in that socket ID, socket.id. This is identical ...

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.