title: Node.js + Socket.io memory leak and max listener
body: <p>I'm node.js beginner. Trying to create simple chat app, but have problem. When refreshed page fast 10+ times I have warning:</p>
  
  <blockquote>
    <p>(node) warning: possible EventEmitter memory leak detected. 11 listeners added. Use emitter.setMaxListeners() to increase limit.</p>
  </blockquote>
  
  <p>When I disabled socket.io, this warning disapears. So, problem with socket.io. How to increase max listeners for socket.io? Or maybe another solution?</p>
  
  <p>Code:</p>
  
  <pre><code>var http = require('http')
  fs = require('fs');
  
  var server = http.createServer(function(req, response) {
      req.setMaxListeners(0);
      var pathname = __dirname + '/index.html'
  
      fs.readFile(pathname, "binary", function(err, file) {
          if (err) {
              response.writeHead(500, {'Content-Type': 'text/plain'});
              response.end(err);
          } else {
              response.writeHead(200, {'Content-Type': 'text/html'});
              response.write(file, "binary");
              response.end();
         }
      });
  });
  
  io = require('socket.io').listen(server);
  server.listen(4567);
  </code></pre>