title: Too long Socketio communication interval
body: <p>My SocketIO server returns a count of 10 to 0 every second, but my web page only updates the number every 10-15 seconds. However, my NodeJS console well displays this count.</p>
  
  <p>In addition, when I manually reload my web page, my browser shows me the correct figure, but suddenly I have to wait 10-15 seconds for it to display the next digit.</p>
  
  <p>NodeJS part</p>
  
  <pre><code>var http = require('http');
  var fs = require('fs');
  require('events').EventEmitter.prototype._maxListeners = 100;
  
  
  
  var server = http.createServer(function(req, res) {
      fs.readFile('./serv.html', 'utf-8', function(error, content) {
          res.writeHead(200, {"Content-Type": "text/html"});
          res.end(content);
      });
  });
  function envoi(p1){
      var io = require('socket.io').listen(server);
      io.sockets.on('connection', function (socket) {
          socket.emit('message', p1);
      });
  }
  main();
  function main(){
      var interval = setInterval(loop, 1000);
      var a = 10;
      function loop(){
          if(a&lt;1){
              clearInterval(interval);
              rolling();
          }
          else{
              console.log(a);
              a--;
              envoi(a);
          }
      }
  }
  function rolling(){
      console.log('ok');
      main();
  }
  server.listen(8080);
  </code></pre>
  
  <p>HTML/JS part</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;meta charset="utf-8" /&gt;
      &lt;title&gt;Socket.io&lt;/title&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
      &lt;h1&gt;Communication avec socket.io !&lt;/h1&gt;
      &lt;div id='r'&gt;Connection..&lt;/div&gt;
  
  
      &lt;script src="jquery.js"&gt;&lt;/script&gt;
      &lt;script src="/socket.io/socket.io.js"&gt;&lt;/script&gt;
      &lt;script&gt;
         var socket = io.connect('http://localhost:8080');
          socket.on('message', function(message) {
              document.getElementById('r').innerHTML = message;
          })
      &lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Thank you :)
  Nathan</p>