var host = null, port = null, sendDelay = 0, actualSendDelay,
            ws = null, send_ref = null,
            sent, received, latencies, ltotal, laverage, lrunning, lmin, lmax,
            run_length = 40,
            payload_size = 2000, payload,
            msg_cnt = 0, recv_seq = 0, send_seq = 0;

        Array.prototype.pushStr = function (str) {
            var n = str.length;
            for (var i=0; i < n; i++) {
                this.push(str.charCodeAt(i));
            }
        }


        fun