title: socket.io seems to be delayed on my Android phone
body: <p><strong>EDIT 2:</strong></p>
  
  <p>I observed the same behavior using <strong>server-sent events (SSE)</strong>. See example <a href="http://cjihrig.com/blog/server-sent-events-in-node-js/" rel="nofollow noreferrer">here</a>. (Of course, it is one way). However, it seems more robust on my Nexus 5 and it doesn't lag frequently. Also it recovers/reconnects fast.</p>
  
  <hr>
  
  <p><strong>EDIT 1:</strong></p>
  
  <p>See also <a href="https://stackoverflow.com/questions/18233636/websocket-interval-performance-problems-on-mobile-devices">Websocket interval...</a> on SO.</p>
  
  <hr>
  
  <p>I'm using a Nexus 5 with Chrome 45 to communicate to my laptop via wifi through the router.</p>
  
  <p>The server on my desktop is coded with node.js version 0.12.7 and I use socket.io 1.3.6. Here is the code for the server:</p>
  
  <pre><code>'use strict'
  const app = require( 'express' )();
  
  app.get( '/', function( req, res ){
      res.render( 'test_socketio_client.ejs' );
  });
  
  let httpServer = app.listen( 8000 );
  
  const io = require( 'socket.io' )( httpServer );
  let i = 0;
  
  io.on( 'connection', function( socket ){
      socket.on( 'req', function( data ){
          console.log( data );
          socket.emit( 'res', {res:'From server', i:i.toString()} );
          ++i;
      });
  });
  </code></pre>
  
  <p>Here is the code for my client:</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
      &lt;meta charset="utf-8"/&gt;
      &lt;title&gt;Test Socket.io&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;h1&gt;Test Socket.io&lt;/h1&gt;
      &lt;hr/&gt;
      &lt;p&gt;From server: &lt;span id="test1"&gt;&lt;/span&gt;&lt;/p&gt;
  
      &lt;script src="//code.jquery.com/jquery-1.11.3.min.js"&gt;&lt;/script&gt;
      &lt;script src="/socket.io/socket.io.js"&gt;&lt;/script&gt;
      &lt;script&gt;
          var socket = io();
          var i = 0;
  
          var f = function(){
                  socket.emit( 'req', {req:'From client', 
                      i:i.toString()} );
              };
  
          socket.on( 'res', function( data ){
              $("#test1").html( data.i );
              ++i;
              setTimeout( f, 1000 );
          });
  
          f();
  
      &lt;/script&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>If I use the browser on my desktop with <code>http://localhost:8000</code> there is no problem but when I use my Nexus 5/Chrome 45 through my home wifi network, <em>socket.io</em> seems to behave by "chunks". As you see, my client/server perform a "ping pong" game, emitting a new message after 1 second. The fact is that I receive the ~10 first messages correctly (i.e. i increases from 0 to 10 in ten seconds) then it blocks for few seconds, then it resumes to transmit. Note that I keep, of course, the page on the top on my phone, it doesn't enter in <em>pause</em> state (?)</p>
  
  <p>My question is: how to avoid that, to make sure an <code>emit</code> will be sent over the web socket as soon as it is called? Did I miss something with socket.io setups? Do I ignore something about web sockets and this behavior is normal?</p>
  
  <p>Any idea?</p>
  
  <p>Thanks!</p>