Skip navigation.

Migrating from CometD 1.x to CometD 2.x

Migrating from CometD 1.x to CometD 2.x

Required JDK Version

CometD 1.x CometD 2.x
JDK 1.5 JDK 1.6 (2.0.0)
JDK 1.5 (2.1.0)


Java Packages and Classes Migration

In general the API classes and interfaces moved from org.cometd.* to org.cometd.bayeux.*.
Server-side implementation classes remained in org.cometd.server.*, and client-side implementation classes remained in org.cometd.client.*.

CometD 1.x CometD 2.x
org.cometd.* org.cometd.bayeux.*
org.cometd.Bayeux org.cometd.bayeux.server.BayeuxServer
org.cometd.Client org.cometd.bayeux.server.ServerSession
org.cometd.Channel org.cometd.bayeux.server.ServerChannel
org.cometd.server.BayeuxService org.cometd.server.AbstractService


Maven Artifacts Migration

CometD 1.x CometD 2.x
org.cometd.java:cometd-api org.cometd.java:bayeux-api

CometD Servlet Migration

CometD 1.x CometD 2.x
org.cometd.server.continuation.ContinuationCometdServlet org.cometd.server.CometdServlet

CometD Servlet Parameter Migration

CometD 1.x CometD 2.x
multiFrameInterval long-polling.multiSessionInterval
requestAvailable N/A (always true)

BayeuxService Migration

CometD 1.x CometD 2.x
org.cometd.server.BayeuxService.subscribe() org.cometd.server.AbstractService.addService()

BayeuxService Method Migration

CometD 1.x CometD 2.x
public void method(Client c, Message m) public void method(ServerSession c, ServerMessage m)

Channel Retrieval Migration

CometD 1.x CometD 2.x
Channel c = bayeux.getChannel("/foo", true) bayeuxServer.createIfAbsent("/foo");
Channel c = bayeuxServer.getChannel("/foo");

Constants Migration

CometD 1.x CometD 2.x
org.cometd.Bayeux.ATTRIBUTE org.cometd.bayeux.server.BayeuxServer.ATTRIBUTE
org.cometd.Bayeux.META_HANDSHAKE org.cometd.bayeux.Channel.META_HANDSHAKE
org.cometd.Bayeux.META_CONNECT org.cometd.bayeux.Channel.META_CONNECT
org.cometd.Bayeux.META_SUBSCRIBE org.cometd.bayeux.Channel.META_SUBSCRIBE
org.cometd.Bayeux.META_UNSUBSCRIBE org.cometd.bayeux.Channel.META_UNSUBSCRIBE
org.cometd.Bayeux.META_DISCONNECT org.cometd.bayeux.Channel.META_DISCONNECT