X-Git-Url: http://mop.ddnsfree.com/gitweb/?a=blobdiff_plain;f=web%2Fxynt-streaming.js;h=72923402614da62b514cc4727056bd6471dfc106;hb=666fa65c2e532d7edbb755492ab757e2ff0f8762;hp=f80e8e82d4ab93d84c150cc242e6b4ecd2401b8a;hpb=ddd822f1dca51731cc9fc8199db3f1cc527fb01a;p=brisk.git diff --git a/web/xynt-streaming.js b/web/xynt-streaming.js index f80e8e8..7292340 100644 --- a/web/xynt-streaming.js +++ b/web/xynt-streaming.js @@ -12,12 +12,14 @@ function transport_ws(doc, xynt_streaming, page) this.failed = false; this.xynt_streaming = xynt_streaming; try { +this.xynt_streaming.log("PAGE: "+page); this.ws = new WebSocket(page); this.ws.onopen = function () { self.xynt_streaming.log("onopen"); if (this.readyState == 1) { // connected self.ws_cb("open"); + self.init_steps = 1; } }; this.ws.onmessage = function (msg) { @@ -26,11 +28,20 @@ function transport_ws(doc, xynt_streaming, page) self.ctx_new += msg.data; }; this.ws.onclose = function (msg) { - self.xynt_streaming.log("onclose"); - self.ws_cb("close"); + this.onopen = null; + this.onclose = null; + this.onerror = null; + self.xynt_streaming.log("onclose"+self.init_steps); + if (self.init_steps == 0) + self.ws_cb("error"); + else + self.ws_cb("close"); }; this.ws.onerror = function () { // on error + this.onopen = null; + this.onclose = null; + this.onerror = null; self.xynt_streaming.log("onerror"); self.ws_cb("error"); }; @@ -49,6 +60,8 @@ transport_ws.prototype = { stopped: true, failed: false, + init_steps: 0, + ctx_old: "", ctx_old_len: 0, ctx_new: "", @@ -68,6 +81,7 @@ transport_ws.prototype = { if (from == "error") { if (this.xynt_streaming != "ready") { if (this.xynt_streaming.transp_fback > 0) { +this.xynt_streaming.log("DEC: "+this.xynt_streaming.transp_fback); this.xynt_streaming.transp_fback--; this.stopped = true; this.xynt_streaming.reload(); @@ -81,6 +95,7 @@ transport_ws.prototype = { ws_abort: function() { if (this.ws != null) { +this.xynt_streaming.log("WSCLOSE"); this.ws.close(); } }, @@ -854,6 +869,7 @@ xynt_streaming.prototype = { //xx this.hbit("+"); // alert("SINGLE: ["+singlecomm+"]"); + // window.console.log("["+singlecomm+"]"); this.cmdproc(singlecomm); again = 1; }