I was excited to learn via the popular blog TechCrunch that FriendFeed announced a beta of "Real-time" updates for their html pages using long polling or server push. This is showcased on a page highlighting the Presidential debate. One of the quotes I like was from Robert Scoble who said “This is wild. It’s like the web has been turned into a chat room.”
The HTTP Publish and Subscribe Server takes advantage of the groundwork laid in previous releases with the Future Response Servlet and Abstract Asynchronous Servlet. A stock tracking example ships with the server shows real-time updates to market data directly in the browser and on a chart. Click the image to enlarge. When you see this example in action, observe that the stock ticker properties and chart are truly "live" and are constantly changing with new market data updates.
Consider how often this comes up in web applications. I'd be shocked if you've never found yourself repeatedly hitting refresh on your browser to
- check the status of an online auction
- try and buy tickets to popular concert at a ticket broker that had a waiting room
- see whether your stock trade went through
- see if you have new web mail
- see if new articles have been posted on a busy news site
Just like the manual refresh situations described above, many web applications have handled stale data checks by automatically refreshing the entire page. MyYahoo and DrudgeReport are both extremely popular sites still perform a periodic complete refresh. Ajax has helped improve this situation to some degree by providing a mechanism to only update a page partially without a complete page refresh, which can be faster and more efficient to the client, network, and server resources than request all the page resources again. However, the AJAX technique often involved periodic server polling techniques, asking the basic question over and over again, "Anything new yet?". The quicker the page needs display new updates, the more often the client still needs to check for them. It should remind you of the long road trip cliche "Are we there yet?".
You can find the information about the stock example and run it with the samples domain.
- Note, use IE or another non-FF browser as the sample application does work with latest version of Firefox, I tried FF 3.0.3. The reason is that the html client code uses an old version of the Dojo Toolkit (0.4) that no longer behaves nicely with FF3. You can tell that this sample was actually built awhile ago in web time. Several new Dojo releases have come out since then, as of this post the latest is 1.1.1, but it's still useful for demonstrating the concept.