4 <title>EventSource Loader Buffering
</title>
6 window
.onload = function () {
7 setTimeout(test_es
, 500);
14 var es
= new EventSource("eventsource-loader-buffering.php");
15 es
.onopen = function () {
16 log("got 'open' event");
17 log("waiting for the first " + step
+ " 'message' events");
19 es
.onmessage = function (evt
) {
20 len
+= evt
.data
.length
;
23 log("got " + count
+ " 'message' events (" + len
+ " characters)", 1);
27 es
.onerror = function () {
28 log("got 'error' event");
32 if (es
.readyState
!= es
.CLOSED
)
38 function log(message
, updateLast
) {
40 log
.list
= document
.getElementById("log");
41 var text
= document
.createTextNode(message
);
43 log
.list
.lastChild
.replaceChild(text
, log
.list
.lastChild
.firstChild
);
45 log
.list
.appendChild(document
.createElement("li")).appendChild(text
);
50 <p>Manual test to verify that the EventSource loader does not buffer data (may result in memory growth with long lived connections). Monitor memory usage; it should be stable. This file has to be served from the same web server as the php script with the same name.
</p>
51 <ul id=
"log" style=
"list-style-type: none"></ul>