title: How to reconnect to websocket after close connection
body: <p>I construct my websocket connection with this code (e.g.):</p>
  
  <pre><code>var socket = new WebSocket("ws://94.12.176.177:8080");
  </code></pre>
  
  <p>And I close the connection with this one:</p>
  
  <pre><code>socket.close();
  </code></pre>
  
  <p>But how do I reestablish connection?</p>
  
  <p>I've done some research and tried several methods. This question could not help me: <a href="https://stackoverflow.com/questions/5898327/socket-io-reconnect-on-disconnect">Socket.io reconnect on disconnect?</a>
  It's the only result which close to what I'm looking for.</p>
  
  <p>The reason I want to do this is to allow users to stop sending data to the web temporary, and resending again after a period of time. Without reconnection, user have to refresh the page in order to resend. This may cause some data lost. Thank you.</p>