26. Create XHR function createXHR() { return window.XMLHttpRequest? new XMLHttpRequest() : new ActiveXObject(‘Microsoft.XMLHTTP’); } IE failed us again in XHR Streaming
28. xhr.readyState 0 open() has not been called yet send() has not been called yet 2 send() has been called, headers and status are available 3 Downloading, responseText holds the partial data 4 Finished with all operations
29. readystatechange event xhr = createXHR(); xhr.onreadystatechange = function() { if ((xhr.readyState >= 3) && (xhr.status === 200)) { // xhr.responseText is all pushed data } }; xhr.open(‘GET’, streamUrl, true); xhr.send();
43. Complete HTTP Streaming Solution XHR Streaming for all non-IE browsers polling xhr.responseText for Opera iFraming Streaming for IE with “htmlfile” hack YUI Gallery Comet Stream http://yuilibrary.com/gallery/show/comet-stream
44. HTTP Streaming: Pros and Cons Real Time Fewer HTTP Request Complex HTTP Proxy could bust it