Friday, March 27th, 2009

Transparent Comet with IceFaces

Category: Comet, Java

We recently posted on Atmosphere, a new framework designed to provide an abstraction layer over Comet back-ends for Java web applications. At a personal level, this comes at an interesting time as over in the Mozilla Labs we’re evaluating different Comet approaches for our upcoming collaboration release. As we looked at various options, we come across some recent postings from Ted Goddard of IceFaces fame explaining their work on making Comet as simple as possible for Java developers, including a podcast and an overview of the IceFaces approach.

Say what you will about JSF, their abstraction layer makes server and client implementation of Comet incredibly simple:

In other words, we can re-use our existing Ajax pipeline, and the application developer only needs to worry about one thing: requesting that a page be rendered. As you can imagine, this is only a few lines of code. With ICEfaces it looks like this:

  1. SessionRenderer.addCurrentSession("ajaxian");
  3. // somewhere else in the presentation tier
  4. SessionRenderer.render("ajaxian");

Not only does the application developer not have to worry about low-level protocol details or messaging, they don’t even have to worry about what has changed on the page — this is all taken care of by the declared binding between the page and the model.

To summarize: we have dynamic pages that can be rendered on the server at any time, and the updates are pushed to the browser where the changes are applied to the DOM. From the application developer’s point of view, that’s all there is to it.

Are you using a stack that makes Comet this easy? Have you been able to successfully implement Comet? Do you get sufficient performance from polling?

Posted by Ben Galbraith at 7:00 am

2.1 rating from 104 votes


Comments feed TrackBack URI

I’ve been using the DOJO client COMET API and Jetty Continuations Module backend (running in Tomcat) for about 2 years now with no trouble, its not a high-throughput application but I use COMET for pushing events for charting, changes in widgets (trees, tables, event viewer). All in all been very happy with performance so far. I would like to some day perhaps get a streaming connection setup, using long-poll currently.

Comment by mjasnowski — March 27, 2009

I’m been using icefaces for some time and its comet support is great.
It even works with the iphone.

We have developed many proof of concepts using icefaces, server push and the iphones. we even sent a few links to ajaxian but they apparently were never considered.

Take a look at our blog page.

Comment by michelle21 — March 27, 2009

I have been using Meteor. It’s fairly easy to set up and I think it’s very easy to integrate. I used it on a forum’s chat room, and it’s a lot faster.

Comment by Thai — March 27, 2009

This article only scratches the surface of the icefaces capabilities. the session renderer is probably the easiest to use. Another is the undemand renderer. By combining several divergent technologies you can come up with some interesting scenarios. The following storyboard is part of a proof of concept I put together using server push.

In the test application described, a client sends a request to a remote calculation server, the calculation server performs the calculation then sends a dns-sd notification to the network, the icefaces application listens for the dns-sd (also known as bonjour) calculation service and watches for a dns update record This event triggers an ondemand render to all open sessions which have been added to the render manager.

if (current != null) {
} else {

here’s the storyboarded workflow

The interesting part here is that only the calc client and the remote calculation server are connected via activeMq, all the other listening clients are notified when a calculation is completed or updated via server push.

We are looking at a way to integrate the icefaces server push into a backend process that involves the iphones new push notification in sdk 3.0.

Comment by michelle21 — March 27, 2009

Given that Joe Walker is working on Bespin with you guys, I would assume DWR is high on the list of frameworks to work with. It certainly is my first choice when it comes to AJAX and Comet.

Comment by plightbo — March 28, 2009

ZK is a Direct RIA framework, it also supports Ajax Push. You can explore various examples here:
a chat room example,
a stock diagram example,

Comment by robbiecheng — March 30, 2009

Another kid on the block for Comet is ItsNat.

Atmosphere will be included any time soon in ItsNat to give more options for Comet but Comet (long polling) can run in any servlet container and almost any browser including mobile.

Try this example and this (remote view control with Comet).

Comment by jmarranz — March 31, 2009

Leave a comment

You must be logged in to post a comment.