To broadcast a new user in the chat, we'll use socket.broadcast.emit and we'll emit a newMessage event, providing our props. The from property, once again, will be set equal to the Admin string; text is going to be set equal to our little message, New user joined; and last up is createdAt, which is going to be set equal to new Date by calling the Date().getTime method:
// socket.broadcast.emit from Admin text New user joined
socket.broadcast.emit('newMessage', {
from: 'Admin',
text: 'New user joined',
createdAt: new Date().getTime()
})
Now we can remove our comment for the second call and everything should work as expected. The next thing you need to do is test out that all of this is working as expected by heading into the browser. There's a couple ways you could have done it; as long as you got it done, it doesn't really matter.