Skip navigation.

CometD 2 Java Client API

CometD 2 Java Client Implementation

The CometD client implementation can be used in any JSETM or JEETM application.

It is made of one main class, org.cometd.client.BayeuxClient, which implements the org.cometd.bayeux.client.ClientSession interface.
Differently from CometD 1, this class now supports pluggable transports (to allow a WebSocket transport to be implemented in future when the WebSocket protocol is standardized), and currently only supports the long polling transport via HTTP, that depends on Jetty's asynchronous HttpClient.

Typical usages of the CometD Java client are:

  • As the transport for a rich thick Java UI (for example, Swing) to communicate to a Bayeux Server (also via firewalls)
  • As a load generator to simulate thousands of CometD clients, like for example org.cometd.client.BayeuxLoadGenerator

The following sections will go in detail about the Java BayeuxClient APIs and their implementation secrets.