title: Socket.io not disconnecting, xhr-polling 400 bad request
body: <p>Io and Angular. When a page is refreshed the disconnect event in socket.io is not fired. I've done some research online which has led me to implement the following</p>
  
  <p><code>io.set('transports', ['xhr-polling']);</code></p>
  
  <p>However when this is set I get the following error;</p>
  
  <p>GET <a href="http://app.local:3000/socket.io/?EIO=3&amp;transport=polling&amp;t=1448414100223-67" rel="nofollow">http://app.local:3000/socket.io/?EIO=3&amp;transport=polling&amp;t=1448414100223-67</a> 400 (Bad Request)</p>
  
  <p>I have the following code;</p>
  
  <p>server.js</p>
  
  <pre><code>var express =   require('express'),
      http =      require('http'),
      server =    http.createServer(app),
      path = require('path'),
      cookieParser = require('cookie-parser'),
      bodyParser = require('body-parser');
  var app = express();
  
  const redis =   require('redis');
  const io =      require('socket.io').listen(server);
  const client =  redis.createClient();
  
  server.listen(3000, '0.0.0.0');
  
  io.listen(server).on('connection', function(client) {
      const redisClient = redis.createClient();
      redisClient.subscribe('user.joined');
      redisClient.on("message", function(channel, message) {
          client.emit(channel, message);
      });
  
      client.on('disconnect', function() {
          redisClient.quit();
      });
  });
  io.set('transports', ['xhr-polling']);
  </code></pre>
  
  <p>Angular code;</p>
  
  <pre><code>var serverBaseUrl = 'http://app.local:3000';
  myApp.factory('socket', function (socketFactory) {
      var myIoSocket = io.connect(serverBaseUrl, {'sync disconnect on unload' : true});
  
      var socket = socketFactory({
          ioSocket: myIoSocket
      });
  
      return socket;
  });
  </code></pre>
  
  <p>any ideas what I'm doing wrong?</p>