title: really strange behaviour on node.js using connect-form, socket.io and express
body: <p>the following code:</p>
  
  <pre><code>req.form.on('progress', function(bytesReceived, bytesExpected){
      var percent = (bytesReceived / bytesExpected * 100) | 0;
      // progressEvent.download(percent);
  
      io.sockets.on('connection', function (socket) {        
        socket.emit('progress', { percent: percent});
        client = socket;
        });        
    });
  </code></pre>
  
  <p>written on an http post handler (express.js) sends socket messages to the client js, but it obviously creates a huge amount of listeners, in fact it warns me saying:
  "node) warning: possible EventEmitter memory leak detected. 11 listeners added. Use emitter.setMaxListeners() to increase limit." </p>
  
  <p>on the other hand this code: </p>
  
  <pre><code>io.sockets.on('connection', function (socket) {
      progressEvent.on('progress', function(percentage) {
      console.log(percentage);
      socket.emit('progress', { percent: percentage});
      });
  });
  </code></pre>
  
  <p>Doesn't send any message back to the client, the ProgressEvent is: </p>
  
  <pre><code>var util = require('util'),
      events = require('events');
  
  function ProgressEvent() {
      if(false === (this instanceof ProgressEvent)) {
          return new ProgressEvent();
      }
  
      events.EventEmitter.call(this);
  }
  </code></pre>
  
  <p>util.inherits(ProgressEvent, events.EventEmitter);</p>
  
  <pre><code>ProgressEvent.prototype.download = function(percentage) {
      var self = this;  
      self.emit('progress', percentage);    
  }
  
  exports.ProgressEvent = ProgressEvent;
  </code></pre>
  
  <p>I've been a good day on this strange problem I can't really see why socket.io doesn't send the socket message to the client. </p>
  
  <p>the whole project is here: <a href="https://github.com/aterreno/superuploader" rel="nofollow">https://github.com/aterreno/superuploader</a></p>
  
  <p>Thanks for your attention &amp; help</p>