From e2493eb6b1693945825b7fcb33570815435ba661 Mon Sep 17 00:00:00 2001 From: Dharmarajsinh Jethva Date: Fri, 20 Aug 2021 12:57:18 -0700 Subject: [PATCH] UPDATE: missing line of code for pushing a socket I've added the missing line of code which pushes the new socket to the connections array. --- lessons/websockets-backend.md | 1 + 1 file changed, 1 insertion(+) diff --git a/lessons/websockets-backend.md b/lessons/websockets-backend.md index 7c12895..bd7c7d0 100644 --- a/lessons/websockets-backend.md +++ b/lessons/websockets-backend.md @@ -177,6 +177,7 @@ Awesome, now this will take the message, parse it using our parseMessage functio let connections = []; // under socket.write(objToResponse), above socket.on('data') +connections.push(socket); // under msg.push inside the if statement in socket.on('data') connections.forEach((s) => s.write(objToResponse({ msg: getMsgs() })));