From 8fee6deed253724ca452ef131a95dff1d3a63616 Mon Sep 17 00:00:00 2001 From: gocivici Date: Sun, 25 Feb 2024 17:00:31 +0300 Subject: [PATCH] socket id error fix --- public/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/index.js b/public/index.js index 9bc7e9a..61b27f9 100644 --- a/public/index.js +++ b/public/index.js @@ -101,8 +101,8 @@ socket.on('updatePlayers', (bPlayers) =>{ }) // console.log(fPlayers[id]) - fPlayers[socket.id].username = localStorage.getItem('username') - socket.emit('username',fPlayers[socket.id].username); + fPlayers[id].username = localStorage.getItem('username') + socket.emit('username',fPlayers[id].username); } else { // if players already exist