title: Socket.io message event firing multiple times
body: <p>I was trying to learn node and started creating a mashup with socket.io
  The message transportation have begin but I have run into some trouble. </p>
  
  <p>The message event is firing multiple times leading to a single message appearing multiple times on the recipient's box. I have routed the socket to <code>exports.chat</code> and was wondering if that is causing the problem? </p>
  
  <p>To narrow down the problem: the messages are firing the number of times = the sequence of connection of the client. That is, if a client connects second, his messages will fire twice. three times for the client connecting third. </p>
  
  <p>Here is the code snippet: <br></p>
  
  <pre><code>exports.chat = function(io, pseudoArray, req, res){
      res.render('chat', {title: 'ChatPanel.'});
  
          var users = 0; 
  
          io.sockets.on('connection', function (socket) { // First connection
              users += 1; 
          //  reloadUsers(io, users); 
  
              socket.on('message', function (data) { // Broadcast the message to all
                  if(pseudoSet(socket)) {
                      var transmit = {date : new Date().toISOString(), pseudo : returnPseudo(socket), message : data};
                      socket.broadcast.emit('message', transmit);
                      console.log("user "+ transmit['pseudo'] +" said \""+data+"\"");
                  }
              });
  
              socket.set('pseudo', req.session.user, function(){
                  pseudoArray.push(req.session.user);
                  socket.emit('pseudoStatus', 'ok');
                  console.log("user " + req.session.user + " connected");
              });
  
              socket.on('disconnect', function () { // Disconnection of the client
                  users -= 1;
              //  reloadUsers();
                  if (pseudoSet(socket)) {
                      var pseudo;
                      socket.get('pseudo', function(err, name) {
                          pseudo = name;
                      });
                      var index = pseudoArray.indexOf(pseudo);
                      pseudo.slice(index - 1, 1);
                  }
              });
          });
  };
  </code></pre>