enable 'usersnet' table with indexes and reading info from it
[brisk.git] / web / xynt-streaming.js
index 1751ca0..610d701 100644 (file)
@@ -5,6 +5,7 @@
 //
 function transport_ws(doc, xynt_streaming, page)
 {
+    this.name = "WebSocket";
     this.ctx_new = "";
     var self = this;
 
@@ -12,6 +13,7 @@ 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");
@@ -27,6 +29,9 @@ function transport_ws(doc, xynt_streaming, page)
             self.ctx_new += msg.data;
         };
         this.ws.onclose = function (msg) {
+            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");
@@ -35,6 +40,9 @@ function transport_ws(doc, xynt_streaming, page)
         };
         this.ws.onerror = function () {
             // on error
+            this.onopen  = null;
+            this.onclose = null;
+            this.onerror = null;
             self.xynt_streaming.log("onerror");
             self.ws_cb("error");
         };
@@ -48,6 +56,7 @@ function transport_ws(doc, xynt_streaming, page)
 
 transport_ws.prototype = {
     doc: null,
+    name: null,
     xynt_streaming: "ready",
     ws: null,
     stopped: true,
@@ -74,6 +83,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();
@@ -87,6 +97,7 @@ transport_ws.prototype = {
 
     ws_abort: function() {
         if (this.ws != null) {
+this.xynt_streaming.log("WSCLOSE");
             this.ws.close();
         }
     },
@@ -152,6 +163,7 @@ transport_ws.prototype = {
 //
 function transport_xhr(doc, xynt_streaming, page)
 {
+    this.name = "XHR";
     this.doc = doc;
     this.xynt_streaming = xynt_streaming;
     this.xhr = createXMLHttpRequest();
@@ -166,6 +178,7 @@ function transport_xhr(doc, xynt_streaming, page)
 
 transport_xhr.prototype = {
     doc: null,
+    name: null,
     xynt_streaming: "ready",
     xhr: null,
     stopped: true,
@@ -281,6 +294,7 @@ transport_xhr.prototype = {
 //
 function transport_htmlfile(doc, xynt_streaming, page)
 {
+    this.name = "HTMLFile";
     this.doc = doc;
     this.xynt_streaming = xynt_streaming;
     this.transfdoc = new ActiveXObject("htmlfile");
@@ -295,6 +309,7 @@ function transport_htmlfile(doc, xynt_streaming, page)
 
 transport_htmlfile.prototype = {
     doc: null,
+    name: null,
     xynt_streaming: null,
     stopped: true,
     ifra: null,
@@ -384,6 +399,7 @@ transport_htmlfile.prototype = {
 //
 function transport_iframe(doc, xynt_streaming, page)
 {
+    this.name = "IFRAME";
     this.doc = doc;
     this.xynt_streaming = xynt_streaming;
     this.ifra = doc.createElement("iframe");
@@ -395,6 +411,7 @@ function transport_iframe(doc, xynt_streaming, page)
 
 transport_iframe.prototype = {
     doc: null,
+    name: null,
     xynt_streaming: null,
     stopped: true,
     ifra: null,
@@ -716,8 +733,7 @@ xynt_streaming.prototype = {
         var ctx_new_len;
 
         if (this.sandbox != null) {
-            // from old: var zug = "POLL sess = "+sess+" stat = "+stat+" subst = "+subst+" step = "+this.gst.st+" step_loc = "+this.gst.st_loc+" step_loc_new = "+this.gst.st_loc_new+" STOP: "+this.stopped;
-            var zug = "WATCHDOG  sess = ["+this.sess+"]  step = "+this.gst.st+" step_loc = "+this.gst.st_loc+" step_loc_new = "+this.gst.st_loc_new;
+            var zug = "WATCHDOG  sess = ["+this.sess+"]  step = "+this.gst.st+" step_loc = "+this.gst.st_loc+" step_loc_new = "+this.gst.st_loc_new+"Transport: "+this.transp.name;
             if (zug != this.sandbox.innerHTML)
                this.sandbox.innerHTML = zug;
         }
@@ -860,6 +876,7 @@ xynt_streaming.prototype = {
                //xx this.hbit("+");
 
                 // alert("SINGLE: ["+singlecomm+"]");
+                // window.console.log("["+singlecomm+"]");
                this.cmdproc(singlecomm);
                again = 1;
            }