How do I completely destroy a socket.io connection?

I'm creating a browser chat from Socket.io and Node.js. Everything has been running smoothly, but I appear to be having a problem with disconnecting sockets. When I run socket.disconnet();, the server runs the socket.on("disconnect", event, but it doesn't actually remove the socket from internal listeners.

When I run socket.disconnect(); on a socket, the socket no longer recieves any new messages, but when the "disconnected" user sends a message, the server receives and sends it back to all clients. I want to create a proper /kick command but it's difficult when I have to restructure all of my code just to accomidate for a simple function.

Commands like socket.connection.destroy();, socket.end();, and socket.transport.destroy(); are invalid and undefined. Does anyone have any suggestions? I've been working on this problem for days and I haven't found any answer other than to set a shutup boolean to the socket and tell the message event to ignore specific sockets. Is this the best way? What happens if the user starts editing javascript code and I need a way from receiving other events from a client?

Well you can see if the socket is connected or not. If socket is connected you can emit the data and vice versa. :) Hope it helps..!

YourProject.sockets.on('connection',function(socket){     
  setInterval(function(){   
    if(!socket.disconnected){
      socket.emit('entrance',{message:'Hey Bro'}); 
    }      
  },10000);        
});

have you tried to interrupt thread ? That should end all I/O operations with an Exception.