Testing the incoming messages

Let's go ahead and test things out over inside Google Chrome. I'm going to refresh tab 1, and when I do you can see our two messages, Welcome to the chat app shows up and Frank says Hi:

Now Welcome to the chat app should show up. The Frank Hi message is coming from socket.emit inside index.js:

socket.emit('createMessage', { 
  from: 'Frank', 
  text: 'Hi' 
}, function (data) { 
  console.log('Got it', data); 
}); 

We can actually go ahead and remove that, we no longer need to automatically emit messages since we have a form set up to get that done for us. Once again we can save the file, refresh the browser and this time ...

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.