Skip to content
This repository was archived by the owner on Sep 21, 2020. It is now read-only.

fix remove nickname from list after disconnect #12

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,11 @@ io.sockets.on('connection', function (socket) { // First connection
var pseudo;
pseudo = socket.nickname;
var index = pseudoArray.indexOf(pseudo);
pseudo.slice(index - 1, 1);
// if nickname found
if (index>-1)
{
pseudo.splice(index, 1);
}
}
});
});
Expand All @@ -81,4 +85,4 @@ function pseudoSet(socket) { // Test if the user has a name
if (socket.nickname == null ) test = false;
else test = true;
return test;
}
}