Thursday 23 October 2008

CSS 2008 - Thursday - Comet and Bayeux

After my gui packed day yesterday, I have moved onto the communication end of things today, starting with two presentations by Filip Hanik on Comet and Bayeux.

The Comet framework is a part of the Tomcat servlet engine. The aim of Comet is to provide the possibility of asynchronous communication between the client and server over an HTTP connection. The presentation began with a summary of HTTP fundamentals, and the standard short poll and long poll paradigms which are usually used to implement async client-server communications. Filip then described the streaming approach which Comet uses, taking advantage of the HTTP protocol to provide an event-driven mechanism by which the server can push data to the client.

It is worth noting, however, that this cannot be used by JavaScript clients, due to limitations in the connections from the browser. The example he gave used a Java applet, implemented using the Sockets API directly.

Whilst this all looks pretty funky (and, yes, I do want to try it out myself), there are some disadvantages. The programming model is not simple, and it is hard to avoid multi-threading issues. Comet does not use a standard API, and is limited to the Tomcat engine, although Jetty and GlassFish also have provide similar mechanism (GlassFish is apparently more advanced). Some of the functionality of Comet is intended to be included in the Servlet 3.0 specification, however, and although this will not be as complete as the Comet implementation, it will at least provide a standard API across different server platforms.

After lunch, I attended Filip's second presentation about Bayeux. Bayeux is a framework introduced by the Dojo foundation which provides a more advanced framework built on top of Comet. The advantage of using the Bayeux servlet is that it is far simpler than using Comet directly. Unlike Comet which does not specify a data protocol to be used by client and server, Bayeux is based on JSON, and therefore links very naturally to the Bayeux client developed by the Dojo foundation.

When discussing the future of the Bayeux framework, Filip's concern is that the Dojo foundation do not appear to have a large developer community involved. It appears that other groups are also looking at solutions and that more initiative needs to be taken if Bayeux is to survive.

No comments: