title: How to get the current status of a javascript websocket connection
body: <p>Sometimes when I restart the server or there is a network failure the websocket gets closed and I would like to be able to get the current connection status at all time.</p>
  
  <p>I am basically getting the following error and I want to be able to predict it :</p>
  
  
  
  <pre><code>WebSocket is already in CLOSING or CLOSED state. 
      (anonymous function) 
      InjectedScript._evaluateOn 
      InjectedScript._evaluateAndWrap 
      InjectedScript.evaluate
  </code></pre>