|
|
|
|
|
The latest episode (#12) of the GlassFish Podcast is out. This is an interview from last week with Jean-François "Grizzly" Arcand on Comet (aka AjaxPush). |
This 20-minute podcast gets into the Comet paradigm, its availability in GlassFish v2 and v3, standardization in the forthcoming Servlet 3.0 specification, and more.
Note also that Jean-François will be delivering three presentations in Canada later this June (2008): Vancouver, Montreal, Toronto.
|
Shin Wai Chan has a nice set of blog entries ([1], [2]) on Comet (aka AJAX Push). He goes on to describe the code on both the client and the server and provides a link to a ready-to-use archive. The second part refines the introduction by describing the use of HTTP streaming.
Although they are documented with an earlier version of GlassFish v3, they apply equally to the latest TP2 promoted build provided you start GlassFish with this |
Comet is not Ajax, it's not polling, and it's not traditional servlet either. This set of short articles is a good way to grasp the Comet paradigm.
Update: Jim has a refined version of Shin's example.
|
Jean Francois (Mr Grizzly) has been working on Comet for quite a while, and it is good to see his perseverance rewarded. GlassFish v2 has Comet support and, although the API will not be standarized until Servlet 3.0, you can use it today. JFA's Latest Writeup explains how to enable Comet, and provides pointers to several sample applications including a jMaki example, a chat program, ICEfaces and DWR examples. BTW, I don't remember if I metioned that we started an Engineering Services. Comet seems a good match for that, so if you are interested, drop an email to JFA. And stay tuned for more articles. |
|
Jean-François "Grizzly" Arcand has posted two slide decks he used last month during his European tour : • Grizzly (covers basics, use in GlassFish V3, and the recent 1.7 release) • Comet, aka Ajax Push (if you ask Jean-François, it's the best thing since slided bread, and who knows, he may be right :) |
|
Interesting Comet use-cases seem to be popping up on a regular basis. This time around IceFaces' Ted is showcasing the WebMC sample application to host a slide presentation over the internet. You can host your own infrastructure (maybe a great new feature for java.net) and check a demonstration here. |
In the latest version of this fully-documented-but-not-yet-final software, the interesting part is the use of Grizzly Comet to scale to a very large number of connections without killing the server with threads (ARP at work here). Unfortunately, I don't believe Skype scales as well in the number of simultaneous connections. Does anyone have a suggestion for an alternate solution for a one-to-many broadcast? A streaming solution maybe...
|
Grizzly has been updated to the latest Bayeux Spec. This includes all the distributions including Grizzly 1.0.19, GlassFish v2.1 (9.1ur1 b09), Sailfin and Grizzly snapshots/1.6.2. GlassFish v3 will follow soon. For more details, check out JFA's note. |
|
Jean-Francois has put a lot of work into making Grizzly (and, by extension, GlassFish) fully capable of servicing Comet applications. He has also worked on documentation, providing an example of the server-side code for a Comet-enabled application in his blog. It's great stuff, but left readers with one obvious question: what about the client side? Well, now Jean-Francois has that one covered too. In his latest blog entry, he shows how to write the client portion of a Comet app. His example uses the Prototype and Behaviour JavaScript libraries, and--of course--it runs on GlassFish. |
|
Comet (also known as "Long Lived HTTP Connections" or "Ajax Push") lets server-side applications notify changes to its clients (Server-Initiated Message Delivery). Typical use-cases include chat, document-sharing application or much more ambitious architectures. Bayeux is a JSON-based protocol specification of Comet and gCometd is the name of the implementation inside Grizzly 1.0.11+ (DOJO or Ajax only) and GlassFish v2 b35+ (JSP, JSF, servlet). |
The Comet/Bayeux spec (0.1draft5) released by the Dojo foundation couple of months ago is now supported in GlassFish v2 build 52. Unfortunately, this specification breaks most comet clients. Jean-François "Grizzly" Arcand recommends that you update to the new DOJO library if that's what you're using (and you probably should be since writing a Bayeux client isn't trivial).
More generally on Comet, check out:
• Comet Basics
• A good presentation
• Writing a Comet web application using GlassFish
• This simple, yet very cool demo.
|
Jonas Jacobi and John Fallows have a good article on the JDJ describing the value of Cometd, Bayeux, et al. to implement Server-Initiated Message Delivery. The article refers to Jetty and Grizzly. It is very nice to see the increased adoption of these technologies, in some cases in real production - stay tuned for some forthcoming Adoption Stories. Check out the article and enjoy! |
|
The Bayeux Tapestry is a famous depiction of the Battle of Hastings. The tapestry is also famous because it shows Halley's Comet so it is fitting that the name for the protocol proposed for Comet (see Ajaxian or TheAquarium) is Bayeux. |
Bayeux is JSON based and allows a COMET client to interact with a server. CometD is an implementation but the protocol should enable others, and JeanFrancois and TAKAI have collaborated to do exactly that using Grizzly. This gCometd can be used in GlassFish expect it in a future build of GlassFish v2. For all all the details check JeanFrancois' blog, but stay tuned for more samples and improvements, specially now that TAKAI has been voted a Grizzly committer.
BTW, I don't want to brag, but check the picture in our intro from last October! :-)
|
Jean-Francois continues to work on Grizzly and Comet. Last month he provided a simple Chat client on GlassFish that explains how to configure Comet support in GlassFish and how to write the corresponding server-side Java: for polling and for request processing. Then Takai (of jRuby fame) joined in (see TAKAI's blog). He says he has an AJAX-based chat and there is a (simple?) live chat here. Also note that Grizzly is on its way to become a separate top-level project at Grizzly.Dev.Java.NET, although the code has not yet moved there; see JFA's blog. |
|
We have been covering Comet for a while (TA articles), and JeanFrancois recently uploaded a Presentation to the Wiki, but a good introduction is always useful, and Andi has a good Introduction to Comet Basics. Check it out! In the meantime, Grizzly seems to continue to get traction; for example see Brian's blog. The Grizzly bundle was recently Added to the Maven Repository, and JeanFrancois is making the framework into a separate, more reusable, project. |
|
Jean-Francois has uploaded a presentation on Comet and Grizzly to the GlassFish Presentation page; it is available under the Creative Commons license (by-nc-sa), like my GlassFish and Java EE 5 presentation, so feel free to use it to spread the word on this work. Also check JFA's blog, the presentation and more TA articles. |
|
GlassFish V2 is incorporating support for Comet through Grizzly and, as we gain more experience, we are improving this support. In his latest blog, Jean-Francois describes how to easily Secure the Comet Communication using SSL (not through a Cone of Silence). I'd expect continued improvements on Comet support through GF V2. |
|
AJAX manipulates the local representation of a Web page using JavaScript and updates it with content (usually XML or JSON) that is fetched dynamically using HTTP. AJAX is becoming very popular because it avoids page refreshes and provides a more dynamic interface but one of its challenges is how to avoid stale data; there are a number of techniques to address this, including polling, piggybacking and long-lived HTTP connections. These approaches have been around for a while in one way or another but, like AJAX, are becoming more popular and are being given different names. For example, the collection of technologies is called Reverse AJAX in DWR 2.0 (blog, Intro@Prokata). And the usef of long-lived HTTP connections, also called HTTP Streaming is also called Comet. Comet is particularly interesting in that it has an impact in the programming model and in the implementation. There is beginning to be enough experience with the model (AsyncWeb, LightStreamer, Jetty's@TSS) to start thinking of standarization and GregW and others have advocated along this direction. One of the interesting developments is that the Grizzly's machinery provides a very good foundation for Comet -- see for example the report from AgileAjax, and Jean-Francois and others are talking about using it more widely in that direction. I hope this will make it into one of our future releases of GlassFish. |
PS. The name Comet is a takeoff on AJAX. This is possibly more of a US-centered joke, so check... AJAX's site (a brand of Colgate-Palmolive) and Comet's site (a brand of Prestige Brands, Inc).