| <title>EventSource Loader Buffering</title> |
| window.onload = function () { |
| setTimeout(test_es, 500); |
| var es = new EventSource("eventsource-loader-buffering.php"); |
| es.onopen = function () { |
| log("waiting for the first " + step + " 'message' events"); |
| es.onmessage = function (evt) { |
| log("got " + count + " 'message' events (" + len + " characters)", 1); |
| es.onerror = function () { |
| log("got 'error' event"); |
| if (es.readyState != es.CLOSED) |
| function log(message, updateLast) { |
| log.list = document.getElementById("log"); |
| var text = document.createTextNode(message); |
| log.list.lastChild.replaceChild(text, log.list.lastChild.firstChild); |
| log.list.appendChild(document.createElement("li")).appendChild(text); |
| <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> |
| <ul id="log" style="list-style-type: none"></ul> |