title: Socket.io connect event not firing
body: <p>This is my first time working with node.js/socket.io and I'm having a little trouble with the 'connect' event firing for all sockets. I followed the chat application example and then tried to add a feature where instead of displaying in the console when a user connects or disconnects, I would display it on-screen.</p>
  
  <p>The disconnect event is firing for all tabs (if I have multiple tabs open to the chat application), but the connect event only seems to fire for the current tab.</p>
  
  <p><strong>Server (index.js)</strong>    </p>
  
  <pre><code>var app = require('express')();
  var http = require('http').Server(app);
  var io = require('socket.io')(http);
  
  app.get('/', function(req, res){
      res.sendFile(__dirname + '/index.html');
  });
  
  io.on('connection', function(socket){
      socket.on('connect', function(){
          io.emit('connect', "A user connected");
      });
      socket.on('disconnect', function(){
          io.emit('disconnect', "A user disconnected");
      });
      socket.on('chat message', function(msg){
          io.emit('chat message', msg);
      });
  });
  
  http.listen(3000, function(){
      console.log('listening on *:3000');
  });
  </code></pre>
  
  <p><strong>Client (index.html)</strong></p>
  
  <pre><code>&lt;script src="/socket.io/socket.io.js"&gt;&lt;/script&gt;
  &lt;script src="http://code.jquery.com/jquery-1.11.1.js"&gt;&lt;/script&gt;
  &lt;script&gt;
      var socket = io();
      $('form').submit(function(){
          socket.emit('chat message', $('#m').val());
          $('#m').val('');
          return false;
      });
      socket.on('chat message', function(msg){
         $('#messages').append($('&lt;li&gt;').text(msg));
      });
      socket.on('disconnect', function(msg){
         $('#users').text(msg);
      });
      socket.on('connect', function(msg){
         $('#users').text(msg);
      });
  &lt;/script&gt;
  </code></pre>