      }

        function disconnect() {
            console.log(">> disconnect");
            if (ws) {
                ws.close();
            }

            if (send_ref) {
                clearInterval(send_ref);
                send_ref = null;
            }
            showStats(); // Final numbers
            recv_seq = 0;
            send_seq = 0;

            $D('connectButton').value = "Start";
            $D('connectButton').onclick = connect;
            console.log("<< disconnect");
        }

