RSS

Rocket – Comet

23 Sep

 

Motivation

Currently GWT contains the very useful RPC mechanism, as a means to communicate with services hosted on a J2EE server. For circumstances where it is more desirable to wait for the server to push rather than poll the comet technique is surprisingly useful. Because of the way comet is typically implemented as a long lived HTTP connection, an application server with a lot of comet clients will quickly have its thread pool exhausted.

Solution

The rocket framework combines the object serialization support provided by GWT and its own client and server glue to provide a comet solution. A number of customisations were required to make all the browsers work and this is taken care of. Each time a new object is pushed down the callback registered on the client is provided with the deserialized incoming object. Behind the scenes the client takes care of other issues such as reestablishing broken connections and so on.

Technical notes

A comet session is started with the creation of a hidden iframe which connects to the comet server servlet.

The servlet periodically pushes either serialized objects or heartbeats. The iframe page gradually continues to grow due to the incoming data.

Every so often the server disconnects, so the client can close the iframe in order to reclaim memory.

The client will attempt to reconnect automatically when a disconnect occurs.

Any java servlet container including tomcat may be used.

Getting started

The following steps below list what and why is needed to use this facility in your own development efforts.

To run the comet demo the embedded tomcat must be running.

 

 

 

 

 

 

Advertisements
 
Leave a comment

Posted by on September 23, 2008 in COMET

 

Tags: , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: