function main()
{
- $st = 0;
+ GLOBAL $st;
+
+ if (!isset($st)) {
+ $st = 0;
+ }
+
$fp = fopen("/tmp/test-hs-rd.log", "a");
fwrite($fp, "START\n");
fclose($fp);
// exit();
sleep(30);
}
- printf("<script id='hs%d' type='text/javascript'>
-push(\"$('cont').innerHTML += '%s %d';\");
-</script>", $i, ($first ? "<br/>" : ""), $i);
+
+printf("<script id='hs%d' type='text/javascript'>
+push(\"$('cont').innerHTML += '%s %d'; gst.st = %d;\");
+</script>", $i, ($first ? "<br/>" : ""), $i, $i);
if ($first)
printf("<!-- %s -->", $s);
<script type="text/javascript" src="xynt/xynt-console.js"></script>
<script type="text/javascript" src="xynt/xynt-http-streaming.js"></script>
<script type="text/javascript"><!--
-var allmythings="BEGIN";
+var gst = null;
<?php
if ($action != 'stop') {
?>
window.onload = function () {
var hs;
- hs = new http_streaming(window, console);
+ var sess;
+
+ sess = '<?php
+ if (!isset($sess)) {
+ $sess = md5(mt_rand());
+ }
+ printf("%s", $sess);
+?>';
+
+ createCookie('sess', sess, 24*365,cookiepath);
+ gst = new globst();
+ hs = new http_streaming(window, gst, sess, console);
// FIXME: with relative path not work!
hs.start('http://dodo.birds.lan/xynt/test-hs-rd.php');
// hs.start('test-hs-rd.php');
}
?>
-
-
window.onkeypress = function () {
console.log("win kpress");
}
}
}
-function http_streaming(win, cons)
+function http_streaming(win, gst, sess, cons)
{
this.console = cons;
this.win = win;
+ this.sess = sess;
this.doc = win.document;
this.keepalive_old = -1;
this.keepalive_new = -1;
- this.gst = new globst();
+ this.gst = gst;
this.cmdproc = function(com){eval(com);}
}
console: null,
win: null,
doc: null,
+ sess: null,
ifra: null,
page: null,
watchdog_hdl: null,
this.doc.body.appendChild(this.ifra);
if (page != null)
this.page = page;
+ this.page = url_append_args(this.page, "sess", this.sess, "st", this.gst.st);
+ this.log(this.page);
+
// this.log(this.ifra);
this.ifra.contentWindow.location.href = this.page;
this.watchdog_ct = 0;