title: Check if WebSocket Server is running (on localhost)
body: <p>When I try to initialize a websocket connection to the server running on localhost with </p>
  
  <pre><code>var webSocket = new WebSocket("ws://localhost:8025/myContextRoot");
  </code></pre>
  
  <p>in javascript, but the server hasn't completed starting up yet, I get the error </p>
  
  <blockquote>SCRIPT12029: WebSocket Error: Network Error 12029, A connection with the server could not be established</blockquote>
  
  <p>How can I prevent this? I.e. how do I check if the server has already started or how can I force the WebSocket client to wait for the server?</p>