title: Not emitting/receiving events with socket.io and node.js
body: <p>So I have this very  basic socket.io setup that you have probably seen a thousand times already.</p>
  
  <p>Please not that here that the files are served via apache.</p>
  
  <p><strong>server</strong> (app.js)</p>
  
  <pre><code>var io = require('socket.io').listen(8080);
  
  io.sockets.on('connection', function(socket){ 
      socket.emit('server ready', {msg: 'hi'}) ;
  
      socket.on('random event', function(data) {
          console.log('received');
      })
  }); 
  </code></pre>
  
  <p>and <strong>client</strong> </p>
  
  <pre><code>$(document).ready(function() {
      var socket = io.connect('http://127.0.0.1:8080/projectname/server/');
  
      socket.on('server ready', function(data){ 
          console.log('server ready!'); 
      });
  
      socket.emit('random event', {hurr: 'durr'});
  });
  </code></pre>
  
  <p>However, the only output I get is </p>
  
  <pre><code> debug - websocket writing 5:::{"name":"server ready","args":[{"msg":"hi"}]}
  </code></pre>
  
  <p>in the node console and nothing in the client console. Which is wrong.</p>
  
  <p>I have tried the basic example from the socket.io website and it shows exactly the same behaviour. It logs the emitted data in the node console but nothing else seems to happen.</p>
  
  <p>Edit: Upon further investigation, visiting the site  in Firefox creates a different output in the node console:</p>
  
  <pre><code>info  - handshake authorized 178702677759276313
     debug - setting request GET /socket.io/1/xhr-polling/178702677759276313?t=1339080239192
     debug - setting poll timeout
     debug - client authorized for 
     debug - clearing poll timeout
     debug - xhr-polling writing 1::
     debug - set close timeout for client 178702677759276313
     debug - xhr-polling received data packet �17�1::/stock/server/�66�5::/stock/server/:{"name":"random event","args":[{"hurr":"durr"}]}
     debug - setting request GET /socket.io/1/xhr-polling/178702677759276313?t=1339080239263
     debug - setting poll timeout
     debug - clearing poll timeout
     debug - xhr-polling writing 5:::{"name":"server ready","args":[{"msg":"hi"}]}
  </code></pre>
  
  <p>This looks like the data emitted fromt he client actually reached the server. However, it didnt seem to solve the actual problem: the console.log lines and both the client and the server side arent executed. <strong>This output is from Firefox 5.0.1</strong> where it seems to fall back to xhr.</p>
  
  <p>Thanks a lot in advance!</p>