title: socket.io force disconnect client
body: <p>I may be doing something wrong here but I can't get my head around this.</p>
  
  <p>The following does not work:</p>
  
  <p><strong>client</strong></p>
  
  <pre><code>$("#disconnectButton").click(function() {
    socket.emit("disconnect");
  });
  </code></pre>
  
  <p><strong>server</strong></p>
  
  <pre><code>socket.on("disconnect", function() {
    console.log("this never gets called");
  });
  </code></pre>
  
  <p>Can't I manually call the disconnect event from the client side? Because the following works:</p>
  
  <p><strong>client</strong></p>
  
  <pre><code>$("#disconnectButton").click(function() {
    socket.emit("whatever");
  });
  </code></pre>
  
  <p><strong>server</strong></p>
  
  <pre><code>socket.on("whatever", function() {
    socket.disconnect();
    console.log("this gets called and disconnects the client");
  });
  </code></pre>