Updating the chat.js and server.js files

Currently, the name User, the incorrect name we see inside of the browser that comes from socket.emit function in chat.js:

socket.emit('createMessage', {
  from: 'User',
  text: messageTextbox.val('')
}, function() {
  messageTextbox.val('')
});

The client originally sent the name but this is no longer going to be the case, the name is stored by the server so we're going to remove this as a required property from createMessage, we're just going to be sending the text across.

socket.emit('createMessage', {
  text: messageTextbox.val('')
}, function() {
  messageTextbox.val('')
});

Now with this in place we can modify the event listener over inside of server.js. Inside server.jscreateMessage takes those two ...

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.