From eb84248f2a96de64c2c812095be89f73abeebd93 Mon Sep 17 00:00:00 2001 From: Klemek Date: Sun, 9 Jun 2019 16:32:10 +0200 Subject: [PATCH] Trying to fix user list --- chat.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/chat.js b/chat.js index b1f5aec..59b86f8 100644 --- a/chat.js +++ b/chat.js @@ -44,7 +44,7 @@ io.on('connection', function (socket) { socket.iid = randint(9999999); socket.name = 'anonymous#' + ('0000' + randint(0,9999)).slice(-4); socket.color = randomColor(); - list[socket.iid] = socket; + list['u'+socket.iid] = socket; console.log(socket.name + ' connected'); socket.emit('chat message', { color: '#fff', @@ -61,7 +61,7 @@ io.on('connection', function (socket) { text: '' + escapeHtml(socket.name) + ' connected.' }); socket.on('disconnect', function () { - delete list[socket.iid]; + delete list['u'+socket.iid]; console.log(socket.name + ' disconnected'); io.emit('chat message', { color: '#fff',