title: socket.on('connection' ... event never fired nodejs + express + socket.io
body: <p><strong>Problem</strong> socket.io NOT working</p>
  
  <p><strong>Details</strong></p>
  
  <ul>
  <li>Generated a project with <code>express [folder]; cd [folder]; npm install;</code></li>
  <li>Setup socket.io <code>npm install socket.io</code></li>
  <li>Run node app with below code</li>
  <li>Client <strong>connect</strong> event fires but server <strong>connection</strong> NEVER fired.</li>
  </ul>
  
  <p><strong>Setup</strong></p>
  
  <ul>
  <li><strong><em>Server</em></strong> AWS Free Tier, Ubuntu 11.10, ami-a7f539ce</li>
  <li>nodejs v0.6.5 </li>
  <li>express v2.5.1 </li>
  <li>socket.io v0.8.7</li>
  </ul>
  
  <p><strong>Client</strong></p>
  
  <pre><code> var socket = io.connect('http://example.com:3000');
  
   socket.on('connect', function() { 
      console.log('connected');
   });
  
   socket.on('message', function(msg){
      console.log(msg);
   });
  
   socket.on('disconnect', function() {
      console.log('disconnected');
   });
  
   socket.on('error', function (e) {
      console.log('System', e ? e : 'A unknown error occurred');
   });
  </code></pre>
  
  <p><strong>Server</strong></p>
  
  <pre><code> [...]
  
   app.listen(3000);
  
   // socket.io setup
   var socket = require('socket.io').listen(app);
  
   // socket.io connection establishment
   socket.on('connection', function (client) {
      client.send("hello");
      console.log("hello", client);           
   });
  </code></pre>
  
  <p>Why is <strong>connection</strong> event never fired?</p>