Comet Book Interview: Comet and Reverse Ajax: The Next Generation Ajax 2.0

by Comet DailyMarch 28th, 2008

Dave Crane’s book “Comet and Reverse Ajax: The Next Generation Ajax 2.0,” co-written by Phil McCarthy, is being published by Apress and will soon be available from Amazon.com.

Comet Daily: How did you get interested in Comet?

Dave Crane: Just following my nose really. I forget when I first heard about it, but it seemed to make sense in light of a few issues that I had with a project I was working on at the time. As I remember, I wanted to report ongoing progress on a long-running job on the server that typically took ten or fifteen minutes to complete. The first solution used polling to keep up to date, but I knew there had to be a better way of doing it.

I started off with some very naive Comet code. I think my first prototype was a single JSP stuffed with calls to Thread.sleep()! Then I started to pick up the real stuff, like Jetty’s continuations and DWR 2.0.

How do you explain Comet’s importance to people who’ve only used other real-time techniques like Ajax? How about to people who aren’t programmers at all?

There are three core use cases for Comet—pushing data to dashboards, long-running progress reports and collaborative applications. In most industries, you don’t have to look far to find one of these coming up as a requirement.

So, I don’t really need to go out looking for reasons to implement Comet. If one of those crops up as a central part of an application design, then some form of Comet is often a good way to tackle it.

What made you decide the time is right for a book about Comet?

In all honesty, I’ve been thinking about this book for over a year. Given a sufficient supply of free time, I’d have already published a book some time ago explaining how Comet was still in its early days, and quite hard to get right, with a discussion of how to get by using polling and piggy-backing unless it was really performance-critical. I’m quite glad that I was too busy to get that far :) In the last six months or so, I think Comet’s tipped to the point of becoming fairly easy to use in a reliable way. Purely within the Java world, with which I’m most familiar, we’re seeing support being built in to Jetty, DWR, and Resin, and even Tomcat 6.0 is dipping its toes in the water.

What types of readers is the book targeted towards?

Intermediate, I guess. I’m assuming familiarity with Ajax and basic web technologies. I’m also tending towards a Java bias, just reflecting my own areas of knowledge, but trying to keep the discussion general enough for most programmers.

Which Comet server and Comet client implementations are covered in the book?

I start off by doing it all the hard way, so as to illustrate all the challenges and pitfalls, before looking at the solutions offered by the more mature toolkits. We’re mainly looking at DWR and Jetty with the dojox.comet packages on the client.

What techniques, transports, and protocols do you discuss?

We provide examples of long polling and request streaming. I’m also keen to illustrate how to use Comet alongside a traditional domain model, rather than just a client-to-client chat-style communication in which the server is merely providing the conduit. Of the three use cases that I mentioned above, I think collaborative operation on a domain model is the most compelling, and I’d be doing the readers a disservice if I got them too excited about Comet and then didn’t provide a working example with a bit of CRUD in it.

What are the biggest challenges facing Comet use by developers? Any possible solutions to those challenges?

From my travails at building a naive comet implementation from scratch, one can come away thinking the entire world is against you. We’re using HTTP in a way that is counter to a lot of the assumptions made by framework and infrastructure developers, and I’ve been tripped up by gotchas in the web browser, client-side libraries like Prototype, server-side controllers and ORM systems, and even proxy servers. Not that any of these are badly-designed—for the majority of non-Comet HTTP uses, the designs make perfect sense.

Anyway, the new wave of robust, mature Comet solutions takes a lot of that pain away and provides an infrastructure that helps rather than hinders. I think the biggest challenge that remains is a conceptual one. Moving to a truly event-driven architecture requires something of a fundamental rethink in how a web application works.

Given your research in writing the book, which Comet implementation(s) would you recommend now? And which Comet implementations seem most promising?

I’m going to treat these as one question, I think. I don’t think the field’s quite mature enough yet to separate out the young upstarts from the crusty old duffers! In the eyes of many a technological conservative, all Comet implementations are still a bit cutting edge and suspect, I think.

I can only really speak of the Java world (and even then, I wish vendors and open source would stop putting out so many high quality implementations. I want this to be a small book!). DWR provides a very good end-to-end Comet package. I’ve a lot of admiration for Greg Wilkins’ work on Jetty too. It’d great to see it at the cutting edge again.

Finally, when will the book be available?

When I’ve finished writing it! Comet’s moving pretty quickly at the moment, and I need to draw a line under it somewhere, and stop tracking the cutting edge and tidy up for publication. We’re aiming to get it out this calendar year.

One Response to “Comet Book Interview: Comet and Reverse Ajax: The Next Generation Ajax 2.0”

  1. Comet Daily » Blog Archive » This Week in Comet Says:

    [...] few months ago we interviewed David Crane about his forthcoming book Comet and Reverse Ajax: The Next Generation Ajax 2.0. According to the [...]


Copyright 2015 Comet Daily, LLC. All Rights Reserved