title: Transport polling error with Socket.Io
body: <p>I'm getting a transport error when using socket.io v1.3.2. It's just meant to be a test for socket.io so I can familiarize myself with it. </p>
  
  <p>I have a file <code>app.js</code> (taken directly from socket.io docs): </p>
  
  <pre><code>var app = require('http').createServer(handler);
  var io = require('socket.io')(app);
  var fs = require('fs');
  
  app.listen(3000);
  
  function handler (req, res) {
    fs.readFile(__dirname + '/index.html',
    function (err, data) {
      if (err) {
        res.writeHead(500);
        return res.end('Error loading index.html');
      }
  
      res.writeHead(200);
      res.end(data);
    });
  }
  
  io.on('connection', function (socket) {
    socket.emit('news', { hello: 'world' });
  });
  </code></pre>
  
  <p>And a file <code>index.html</code>: </p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;meta http-equiv="X-UA-Compatible" content="IE=edge"&gt;
      &lt;title&gt;&lt;/title&gt;
      &lt;link rel="stylesheet" href=""&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;h1&gt;Socket Test&lt;/h1&gt;
      &lt;script src="/socket.io/socket.io.js"&gt;&lt;/script&gt;
      &lt;script&gt;
          var socket = io.connect('http://localhost');
          socket.on('news', function (data) {
              console.log(data);
          });
      &lt;/script&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>In the console, I get the following error:</p>
  
  <pre><code>GET http://localhost/socket.io/?EIO=3&amp;transport=polling&amp;t=1422782880286-40 
  (index):1 XMLHttpRequest cannot load http://localhost/socket.io/?EIO=3&amp;transport=polling&amp;t=1422782880286-40. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:3000' is therefore not allowed access. The response had HTTP status code 404.
  socket.io.js:3715 engine.io-client:socket socket error {"type":"TransportError","description":0} +37ms
  socket.io.js:1402 socket.io-client:manager connect_error +38ms
  socket.io.js:1402 socket.io-client:manager reconnect attempt error +1ms
  socket.io.js:1402 socket.io-client:manager will wait 5000ms before reconnect attempt +0ms
  socket.io.js:3715 engine.io-client:socket socket close with reason: "transport error" +2ms
  socket.io.js:3715 engine.io-client:polling transport not open - deferring close +1ms
  socket.io.js:1402 socket.io-client:manager attempting reconnect +5s
  socket.io.js:1402 socket.io-client:manager readyState closed +0ms
  socket.io.js:1402 socket.io-client:manager opening http://localhost +0ms
  socket.io.js:3715 engine.io-client:socket creating transport "polling" +5s
  socket.io.js:3715 engine.io-client:polling polling +0ms
  socket.io.js:3715 engine.io-client:polling-xhr xhr poll +0ms
  socket.io.js:3715 engine.io-client:polling-xhr xhr open GET: http://localhost/socket.io/?EIO=3&amp;transport=polling&amp;t=1422782885332-41 +1ms
  socket.io.js:3715 engine.io-client:polling-xhr xhr data null +0ms
  socket.io.js:3715 engine.io-client:socket setting transport polling +1ms
  socket.io.js:1402 socket.io-client:manager connect attempt will timeout after 20000 +3ms
  </code></pre>
  
  <p>Does anyone know how to fix this error. I found <a href="https://github.com/Automattic/socket.io-client/issues/641" rel="noreferrer">this discussion</a>, but have been unable to solve the problem. </p>