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.
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.
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.
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.