From 865cb740c39d77fdb20de3a9964be205491bee21 Mon Sep 17 00:00:00 2001 From: "Matteo Nastasi (mop)" Date: Sun, 1 Apr 2012 16:53:03 +0200 Subject: [PATCH] first http-streaming with iframe working on ff and ie --- web/test-hs-rd.php | 53 +++++++++++++++++++++++++++++++++ web/test-hs.php | 21 +++++++++++++ web/xynt/xynt-http-streaming.js | 50 +++++++++++++++++++++++++++++++ 3 files changed, 124 insertions(+) create mode 100644 web/test-hs-rd.php create mode 100644 web/test-hs.php create mode 100644 web/xynt/xynt-http-streaming.js diff --git a/web/test-hs-rd.php b/web/test-hs-rd.php new file mode 100644 index 0000000..67bc876 --- /dev/null +++ b/web/test-hs-rd.php @@ -0,0 +1,53 @@ + + + + + + parent.allmythings = %d; + console.log(\"zorro \"+parent.allmythings); + + ", $i, $i); + } + else { + printf("", $i, $i); + } + if ($i == 0) + printf("", $s); + mop_flush(); + usleep(1000000); + } +} +main(); +?> + + + + \ No newline at end of file diff --git a/web/test-hs.php b/web/test-hs.php new file mode 100644 index 0000000..5f48ac3 --- /dev/null +++ b/web/test-hs.php @@ -0,0 +1,21 @@ + + + + + + + +
INIT
+ + diff --git a/web/xynt/xynt-http-streaming.js b/web/xynt/xynt-http-streaming.js new file mode 100644 index 0000000..cd31ead --- /dev/null +++ b/web/xynt/xynt-http-streaming.js @@ -0,0 +1,50 @@ +function http_streaming(doc) +{ + this.doc = doc; + this.keepalive_old = -1; + this.keepalive_new = -1; + this.keepalives_equal = 0; + this.ifra = doc.createElement("iframe"); + this.ifra.style.visibility = "hidden"; + doc.body.appendChild(this.ifra); + // this.ifra.contentWindow.onload = function () { + // this.ifra.contentWindow.location.href = 'winstream_rdxxx.php'; + // } + +} + +http_streaming.prototype = { + doc: null, + ifra: null, + keepalive_old: -1, + keepalive_new: -1, + keepalives_equal: 0, + keepalives_eq_max: 6, + + start: function(page) { + this.ifra.contentWindow.location.href = page; + }, + + watchdog: function () { + /* +this.keepalives_equal */ + console.log("watchdog "); + if (this.keepalive_old == this.keepalive_new) { + this.keepalives_equal++; + } + else { + this.keepalives_equal = 0; + } + + if (this.keepalives_equal > this.keepalives_eq_max) { + console.log("MAX ACHIEVED "+this.keepalives_equal); + } + else { + setTimeout(function(obj) { obj.watchdog() }, 2000, this); + } + }, + + keepalive: function () { + this.keepalive_new++; + } + +} \ No newline at end of file -- 2.17.1