title: How to reconnect when a WebSocket disconnects?
body: <p>Example:</p>
  
  <pre><code>var WebSocket = require('ws');
  var ws = new WebSocket('ws://echo.websocket.org/', {protocolVersion: 8, origin: 'http://websocket.org'});
  ws.on('open', function() {
      console.log('connected');
      ws.send(Date.now().toString(), {mask: true});
  });
  ws.on('close', function() {
      console.log('disconnected');
      // What do I do here to reconnect?
  });
  </code></pre>
  
  <p>What should I do when the socket closes to reconnect to the server?</p>