w WebSocket(wsURI);
      ws.onopen = function() { log.innerHTML += 'CONNECTED<br/>'; }
      ws.onmessage = function(ev) {
        console.log(ev.data);
        try {
          var msg = JSON.parse(ev.data);
          log.innerHTML += 'RECEIVED: ' + JSON.stringify(msg) + '<br/>';
        } catch (e) {
          console.log('Invalid ws frame:', ev.data);
        }
      };
      ws.onclose = function() {
        clearTimeout(tid);
        tid = setTimeout(reconnect, 1000);
        log.innerHTML += 'DISCONNE