X-Git-Url: https://mop.ddnsfree.com/gitweb/?a=blobdiff_plain;f=web%2Fxynt_test01.php;h=f9efb7b35376421b61a93d3b332dda9e99ad0ae6;hb=9c35bacfc8208c5201dd2db7821921fd23ba3c08;hp=78aeca04077d5a440b1416a408222ceedb5caf6c;hpb=6b3deca05aae68fbef085dd42861c19e546f8d25;p=brisk.git diff --git a/web/xynt_test01.php b/web/xynt_test01.php index 78aeca0..f9efb7b 100644 --- a/web/xynt_test01.php +++ b/web/xynt_test01.php @@ -1,5 +1,13 @@ il client aspetta 3 secondi, e poi da 10 a N ogni secondo, (status sempre verde)."); + + $transs = array( "iframe", "xhr", "htmlfile" ); if (!isset($f_trans)) $f_trans = $transs[0]; @@ -25,6 +33,14 @@ function escpush($s) return str_replace($escpush_from, $escpush_to, $s); } +function xcape($s) +{ + $from = array ( '\\', '@', '|' ); + $to = array ( '\\\\', '@', '¦' ); + + return (str_replace($from, $to, htmlentities($s,ENT_COMPAT,"UTF-8"))); +} + if ($isstream == "true") { require_once("Obj/transports.phh"); @@ -68,6 +84,15 @@ if ($isstream == "true") { } break; case 2: + // from 1 to 9 into the innerHTML and than close + for ($i = 1 ; $i < 10 ; $i++) { + $chunk = $transp->chunk($i, sprintf("gst.st++; \$('container').innerHTML = gst.st;")); + print($chunk); + mop_flush(); + sleep(1); + } + break; + case 3: // from 1 to 9 with 60 secs after 8, the client js api must restart stream after 12 secs for ($i = 1 ; $i < 10 ; $i++) { $chunk = $transp->chunk($i, sprintf("\$('container').innerHTML = '%d';", $i)); @@ -78,7 +103,7 @@ if ($isstream == "true") { sleep(60); } break; - case 3: + case 4: // from 1 to 9 into the innerHTML and than close for ($i = 1 ; $i < 10 ; $i++) { if ($i != 5) { @@ -92,6 +117,46 @@ if ($isstream == "true") { sleep(1); } break; + case 5: + // from 1 to 9 into the innerHTML and than close + $cont = array('@BEGIN@', '@END@', '@BEGIN@ sleep(1); @END@'); + for ($i = 1 ; $i < 10 ; $i++) { + switch($i) { + case 6: + case 7: + case 8: + $chunk = $transp->chunk($i, sprintf("\$('container').innerHTML = '%s';", xcape($cont[$i - 6]))); + break; + default: + $chunk = $transp->chunk($i, sprintf("\$('container').innerHTML = '%d';", $i)); + break; + } + print($chunk); + mop_flush(); + if ($i < 9) + sleep(1); + } + break; + case 6: + // from 1 to 9 into the innerHTML and than close + if ($step == 8) { + $chunk = $transp->chunk(1, sprintf("gst.st++; \$('container').innerHTML = gst.st;")); + print($chunk); + // without this usleep the delay is doubled in iframe stream because + // no transp.xynt_streaming back-set is performed + usleep(250000); + mop_flush(); + } + else { + for ($i = 1 ; $i < 10 ; $i++) { + $chunk = $transp->chunk($i, sprintf("gst.st++; \$('container').innerHTML = gst.st;")); + print($chunk); + mop_flush(); + if ($i < 9) + sleep(1); + } + } + break; } exit; } @@ -102,6 +167,7 @@ if ($isstream == "true") { + @@ -113,7 +179,7 @@ if ($isstream == "true") { window.onload = function() { xstm = new xynt_streaming(window, "", null /* console */, gst, 'xynt_test01_php', 'sess', sess, null, 'xynt_test01.php?isstream=true&f_test=', function(com){eval(com);}); - /* xstm.hbit_set(heartbit); */ + xstm.hbit_set(heartbit); xstm.start(); } //--> @@ -123,13 +189,10 @@ if ($isstream == "true") {
"); -for ($test = 1 ; $test <= 3 ; $test++) { +for ($test = 1 ; $test <= count($desc) ; $test++) { printf(""); foreach ($transs as $trans) { printf("Test %s %02d", $trans, $test, $trans, $test); @@ -142,6 +205,11 @@ printf("
[%s]
Test: %d
", $f_trans, $f_test);
Descrizione: +
+ +
+Status:
+
Counter: