-function http_streaming(doc)
+function http_streaming(doc, cons)
{
+ this.console = cons;
this.doc = doc;
this.keepalive_old = -1;
this.keepalive_new = -1;
}
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++;
}
}
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