My website has an IM with several users connected. From my client I wish to disconnect a particular user. Here is the code I am trying:
// client side
function deleteUser(delCallsign)
{
delCallsign = delCallsign.toUpperCase();
socket.emit('deleteuser', delCallsign); // send it to the server for delete
}
// server side
socket.on('deleteuser', function(callsign)
{
socket.disconnect(usernames[callsign]);
io.sockets.emit('updateusers', usernames);
});
Using an alert, I have verified that I'm calling the server side function with the username I wish to disconnect. But what happens is that I get disconnected, not the user specified. What am I doing wrong here?