I've written an application with tornado to support real time updates on my website through HTTP streaming. It works in all browsers except IE7 and IE8. Here is the code that handles the HTTP streaming:
... code to create xhr object
xhr.open('GET', 'http://192.168.0.173:8888', true);
xhr.onreadystatechange = function() {
if(xhr.readyState == 3 && xhr.status==200) {
try {
alert(xhr.responseText);
} catch(e) {
alert("noo");
}
}
}
setTimeout("xhr.send(null);", 1000);
The problem is that xhr.responseText is not available when readyState is 3. After a few hours of google I learned about IXMLHTTPRequest.responseStream. I tried to use
xhr = new ActiveXObject("MSXML2.XMLHTTP.3.0");
but with the same result. The request is sent to the server and readyState is 3 but xhr.responseStream is not available.
Any ideas? Or should I fall back to long polling when I detect IE?
Thank you
Henry