title: Handle disconnect / logout events
body: <p>After connecting the client subscribes to a specific room which contains all connected users:</p>
  
  <pre><code>io.socket.get('/connection/subscribe', function(data, jwr) {
    io.socket.on('user_connected', function(user) { console.log('new bro connected'); });
  });
  </code></pre>
  
  <p>At the moment I'm just storing user ids in the memory. Therefor I use a single variable,</p>
  
  <pre><code>var connectionIDs = [];
  
  /*...*/
  subscribe: function(req, res) {
      if(typeof req.user !== 'undefined') {
          sails.sockets.join(req.socket, 'users_online');
  
          User.find(req.user.id).exec(function(err, user) {
              if(connectionIDs.indexOf(user[0].id) == -1) {
                  connectionIDs.push(user[0].id);
              }
              sails.sockets.broadcast('users_online', 'user_connected', user);
          });
  
          return res.ok();
      }
  },
  </code></pre>
  
  <p>Everything works fine so far, my only problem is handling disconnect or logout events. After closing the window, logging out or similar I need to unsubsribe from the <code>users_online</code> room.</p>
  
  <p>Already tried</p>
  
  <pre><code>io.socket.on('disconnect', function() { io.socket.post('/disconnect', function() { }));
  </code></pre>
  
  <p>but sadly the request is never sent. How to handle the disconnect event properly?</p>