'open', function() {
                send_ref = setTimeout(sendMsg, sendDelay);
            });
            ws.on('close', function(e) {
                disconnect();
            });
            ws.on('error', function(e) {
                message("Websock error: " + e);
                disconnect();
            });

            console.log("<< init_ws");
        }

        function connect() {
            console.log(">> connect");
            host = $D('host').value;
            port = $D('port').value;
 