ed(2);
        }

        function init_ws() {
            console.log(">> init_ws");
            var scheme = "ws://";
            if ($D('encrypt').checked) {
                scheme = "wss://";
            }
            var uri = scheme + host + ":" + port;
            console.log("connecting to " + uri);
            ws = new Websock();
            ws.maxBufferedAmount = 5000;
            ws.open(uri);

            ws.on('message', function() {
                recvMsg();
            });
            ws.on(