From f70bcce463e6c3fa075013e718acf3f07454ccd6 Mon Sep 17 00:00:00 2001 From: Courtney Landau Date: Tue, 4 Jun 2019 16:22:23 -0400 Subject: [PATCH] spelling and grammar fixes (#36061) * spelling and grammar fixes * Update curriculum/challenges/english/06-information-security-and-quality-assurance/advanced-node-and-express/send-and-display-chat-messages.english.md Co-Authored-By: Tom <20648924+moT01@users.noreply.github.com> --- .../send-and-display-chat-messages.english.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/curriculum/challenges/english/06-information-security-and-quality-assurance/advanced-node-and-express/send-and-display-chat-messages.english.md b/curriculum/challenges/english/06-information-security-and-quality-assurance/advanced-node-and-express/send-and-display-chat-messages.english.md index 209bbc41b9..a0164aa022 100644 --- a/curriculum/challenges/english/06-information-security-and-quality-assurance/advanced-node-and-express/send-and-display-chat-messages.english.md +++ b/curriculum/challenges/english/06-information-security-and-quality-assurance/advanced-node-and-express/send-and-display-chat-messages.english.md @@ -7,8 +7,8 @@ challengeType: 2 ## Description
As a reminder, this project is being built upon the following starter project on Glitch, or cloned from GitHub. -It's time you start allowing clients to send a chat message to the server to emit to all the clients! Already in your client.js file you should see there is already a block of code handling when the messgae form is submitted! ($('form').submit(function(){ /*logic*/ });) -
Within the code you're handling the form submit you should emit an event after you define 'messageToSend' but before you clear the text box #m. The event should be named 'chat message' and the data should just be 'messageToSend'. socket.emit('chat message', messageToSend); +It's time you start allowing clients to send a chat message to the server to emit to all the clients! Already in your client.js file you should see there is already a block of code handling when the message form is submitted. ($('form').submit(function(){ /*logic*/ });) +
Within the form submit code, you should emit an event after you define 'messageToSend' but before you clear the text box #m. The event should be named 'chat message' and the data should just be 'messageToSend'. socket.emit('chat message', messageToSend); Now on your server you should be listening to the socket for the event 'chat message' with the data being named 'message'. Once the event is received it should then emit the event 'chat message' to all sockets io.emit with the data being an object containing 'name' and 'message'. On your client now again, you should now listen for event 'chat message' and when received, append a list item to #messages with the name a colon and the message! At this point the chat should be fully functional and sending messages across all clients! Submit your page when you think you've got it right. If you're running into errors, you can check out the project up to this point here for the server and here for the client.