X-Git-Url: https://mop.ddnsfree.com/gitweb/?p=xynt.git;a=blobdiff_plain;f=web%2Fxynt%2Fxynt-http-streaming.js;fp=web%2Fxynt%2Fxynt-http-streaming.js;h=cb914e051cce4ae826a95a5081418d54e4b2c9d0;hp=cd31eadece161ba932884c5576a3a898bb446b54;hb=d19a7117e6b2e345f5b7932afe1e68ade3ee1cb9;hpb=2c18a4f7520fb6bbe5b11e5f07dcce2740585c15 diff --git a/web/xynt/xynt-http-streaming.js b/web/xynt/xynt-http-streaming.js index cd31ead..cb914e0 100644 --- a/web/xynt/xynt-http-streaming.js +++ b/web/xynt/xynt-http-streaming.js @@ -1,5 +1,6 @@ -function http_streaming(doc) +function http_streaming(doc, cons) { + this.console = cons; this.doc = doc; this.keepalive_old = -1; this.keepalive_new = -1; @@ -14,20 +15,24 @@ function http_streaming(doc) } http_streaming.prototype = { + console: null, doc: null, ifra: null, keepalive_old: -1, keepalive_new: -1, keepalives_equal: 0, keepalives_eq_max: 6, + watchdog_timeout: 2000, start: function(page) { + this.log("http_streaming:start"); this.ifra.contentWindow.location.href = page; + setTimeout(function(obj) { obj.watchdog(); }, this.watchdog_timeout, this); }, watchdog: function () { /* +this.keepalives_equal */ - console.log("watchdog "); + this.log("hs::watchdog: start"); if (this.keepalive_old == this.keepalive_new) { this.keepalives_equal++; } @@ -36,15 +41,20 @@ http_streaming.prototype = { } if (this.keepalives_equal > this.keepalives_eq_max) { - console.log("MAX ACHIEVED "+this.keepalives_equal); + this.log("hs::watchdog: MAX ACHIEVED "+this.keepalives_equal); } else { - setTimeout(function(obj) { obj.watchdog() }, 2000, this); + setTimeout(function(obj) { obj.watchdog() }, this.watchdog_timeout, this); } }, keepalive: function () { this.keepalive_new++; + }, + + log: function (s) { + if (this.console != null) { + return (this.console.log(s)); + } } - } \ No newline at end of file