title: node.js sockets.io disconnecting every ~25 seconds (heartbeat-related)
body: <p>I'm trying to set up a node.js server, using socket.io.  The problem I'm seeing is that my server is disconnecting+reconnecting the client every 25 seconds.</p>
  
  <p>Here's my server code:</p>
  
  <pre><code>var io = require('socket.io').listen(5876);
  io.sockets.on('connection', function (socket)
  {
      console.log("New connection established");
  
      socket.on('disconnect', function()
      {
          console.log("A client has disconnected.");
      });
  }
  </code></pre>
  
  <p>My client connects using the socket.io.js distribution.  As I understand it (apparently incorrectly), I need my client to send a "heartbeat" (a message of "::2") every 15 seconds to prevent the server from thinking the connection is dead and disconnecting it.  Basically:</p>
  
  <pre><code>&lt;script src="socket.io.js"&gt;&lt;/script&gt;
  &lt;script&gt;
      var socket = io.connect('http://localhost:5876');
  
      socket.on('connect', function(data)
      {
          console.log("Connected to server.");
          setInterval(function() { socket.emit("::2"); console.log("sent heartbeat"); }, 15000); // schedule a heartbeat for every 15 seconds
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>But the client is still getting disconnected+reconnected every 25 seconds (excluding the very first  25th-second-tick).</p>
  
  <p>The node.js server console log looks like this (may have cut out some earlier identical connect/disconnect phases, as it was echoing every 25 seconds):</p>
  
  <pre><code>New connection established
     debug - emitting heartbeat for client 652791160849839915
     debug - websocket writing 2::
     debug - set heartbeat timeout for client 652791160849839915
     debug - got heartbeat packet
     debug - cleared heartbeat timeout for client 652791160849839915
     debug - set heartbeat interval for client 652791160849839915
     info  - transport end
     debug - set close timeout for client 652791160849839915
     debug - cleared close timeout for client 652791160849839915
     debug - cleared heartbeat interval for client 652791160849839915
  A client has disconnected.
     debug - discarding transport
     debug - client authorized
     info  - handshake authorized 5961067041159055274
     debug - setting request GET /socket.io/1/websocket/5961067041159055274
     debug - set heartbeat interval for client 5961067041159055274
     debug - client authorized for
     debug - websocket writing 1::
  New connection established
  </code></pre>
  
  <p>How can I stop my server from disconnecting+reconnecting the client every 25 seconds?</p>