March 2018
Intermediate to advanced
592 pages
13h 44m
English
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.js, createMessage takes those two ...