In an InfoWorld article, from last week, a mention of using streaming HTTP for advanced Web-based applications was made. There was barely any explanation of the technology and I imagine that some people don’t know how it works. I figured that I could pull together a couple examples to show people. The basic concept is such:
- The most common way for streaming these items is through an IFrame which contains a page that is forever loading – which is seemingly ok, since it’s not the main user page. However, all major browsers will state that the page is still loading as long as the user is on the page. In my opinion, this is a rather large usability issue. Also, if a user does hit the stop button, all of the streaming content will be killed – unbeknownst to them.
- The only way to get around this issue is to use a server push method using a multipart/x-mixed-replace header, which only works in Mozilla-based browsers. You’d think that something that’s a part of HTTP would be implemented across the board in all browsers, but not so.
- Now, if you want to circumvent the use of an IFRAME, you could try using the multipart trick with XMLHTTPRequest (with server side) – which is cool, no doubt, but again doesn’t work in non-Mozilla-based browsers.
- Oh, and while you’re testing – don’t open two streaming pages up in Firefox – it won’t work. Firefox thinks that the first page that you open is still loading and, therefore, should wait until the page is done loading to load the other one too.
- And if you’re running this streaming app in a CGI application that’s behind Apache, be sure that you have GZIP compression turned off – if you don’t, Apache will wait until your entire page loads, in order to try compressing it, before sending it to the browser.
A couple points to consider:
- ‘Typical’ AJAX appliations utilize XMLHTTPRequest doing single requests/updates. The next wave of web applications are going to have more streaming components included. This is going to be an essential portion of any new web application coming out.
- There is very very little aggregated knowledge on the concept of streaming http, which makes development of this technology very hard.
- This is all ironic because this technology has been around for much longer then the use of XMLHTTPRequest and yet is is used less then this ‘newer’ technology. Some of this can bee seen in a post by Matt Haughey about KnowNow using Streaming HTTP.
So, anyway: There needs to be more documentation and more use of Streaming HTTP / Server Push technology – if you don’t use it in your applications, someone else will, I can guarantee it.