From 0655abf8004d2ccd1added9e15e2705ddddcb95c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yoelvis=20=20Jim=C3=A9nez?= <43357527+yoelvisj@users.noreply.github.com> Date: Fri, 15 Feb 2019 04:40:17 -0400 Subject: [PATCH] Typo: I replaced nesesary by necessary (#34884) * Typo: I replaced nesesary by necesary Minor typo. I replaced nesesary by necesary. * Fix nesesary to necessary --- .../advanced-node-and-express/announce-new-users.english.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/curriculum/challenges/english/06-information-security-and-quality-assurance/advanced-node-and-express/announce-new-users.english.md b/curriculum/challenges/english/06-information-security-and-quality-assurance/advanced-node-and-express/announce-new-users.english.md index 30491df9ab..f4e59418f9 100644 --- a/curriculum/challenges/english/06-information-security-and-quality-assurance/advanced-node-and-express/announce-new-users.english.md +++ b/curriculum/challenges/english/06-information-security-and-quality-assurance/advanced-node-and-express/announce-new-users.english.md @@ -9,7 +9,7 @@ challengeType: 2 As a reminder, this project is being built upon the following starter project on Glitch, or cloned from GitHub. Many chat rooms are able to annouce when a user connects or disconnects and then display that to all of the connected users in the chat. Seeing as though you already are emitting an event on connect and disconnect, you will just have to modify this event to support such feature. The most logical way of doing so is sending 3 pieces of data with the event: name of the user connected/disconnected, the current user count, and if that name connected or disconnected.
io.emit('user', {name: socket.request.user.name, currentUsers, connected: true});
-Now your client will have all the nesesary information to correctly display the current user count and annouce when a user connects or disconnects! To handle this event on the client side we should listen for 'user' and then update the current user count by using jQuery to change the text of #num-users
to '{NUMBER} users online', as well as append a <li>
to the unordered list with id 'messages' with '{NAME} has {joined/left} the chat.'.
+Now your client will have all the necessary information to correctly display the current user count and annouce when a user connects or disconnects! To handle this event on the client side we should listen for 'user' and then update the current user count by using jQuery to change the text of #num-users
to '{NUMBER} users online', as well as append a <li>
to the unordered list with id 'messages' with '{NAME} has {joined/left} the chat.'.
An implementation of this could look like the following:socket.on('user', function(data){ $('#num-users').text(data.currentUsers+' users online'); var message = data.name;