title: Is there a need to reaffirm a websocket connection?
body: <p>I have a web application that relies on updated information from a server.  In the past, the client would send an ajax request 1000ms after the completion of the previous.  It worked well, but wasted resources.  The app has been converted to use a websocket when the client supports it (and degrade to Ajax when it doesn't).</p>
  
  <p>In the past, ajax provided a pulse by indicating the browser was refreshing activity every second.  Now, it looks dead and just sits there working. I have the following:</p>
  
  <pre><code>function connect() {
      $("#text1").text('Socket Status: '+socket.readyState+' (connecting)');
      socket.onopen = function(){
          $("#text1").text('Socket Status: '+socket.readyState+' (open)');
      }
      socket.onmessage = function(msg){ checkDATA(msg.data); }
      socket.onclose = function(){ 
          $("#text1").text('Socket Status: '+socket.readyState+' (close)');
          setTimeout(function () { connect(); },500);
      }
      socket.onerror = function(){ 
          $("#text1").text('Socket Status: '+socket.readyState+' (error) '+msg.data);
      }
  }
  </code></pre>
  
  <p>So I do have some indication of the status, but nothing that shows a pulse.  Should I just fake a pulse or is there something different/better that can/should be done to assure the connection is working?</p>