I am using CometD Java client on Android.
compile group: 'org.cometd.java', name: 'cometd-java-client', version: '2.9.1'
I need to subscribe to a channel on a CometD server. But there is a problem - the server requires a custom subscribe message (this is the expected subscribe message payload from the server docs):
[
{
"user": "xyz-WQUAq3shWho1ZcJHaibQYzCh2ILMMX1o-gA6NuehTFYMhvViv6Ow3dvPbyt8Zwg10-bd8bd779f107615b1c5a1470706e4050e5389ddc",
"domain": "xyz",
"pid": "gA6NuehTFYMhvViv6Ow3dvPbyt8Zwg10",
"sid": "85f103a2",
"gid": "WQUAq3shWho1ZcJHaibQYzCh2ILMMX1o",
"pageId": "6ea23e",
"entityId": "xyz",
"triggeringGoal": "3E955818355C44E2479B2A26629E69566C8C6376",
"chatSearchPattern": "ua.domain=xyz",
"startTime": 1482931626853,
"metadata": "{}",
"chatMetadata": "{}",
"language": "en",
"id": "3",
"channel": "\/meta\/subscribe",
"subscription": "\/chat\/xyz-WQUAq3shWho1ZcJHaibQYzCh2ILMMX1o-gA6NuehTFYMhvViv6Ow3dvPbyt8Zwg10-bd8bd779f107615b1c5a1470706e4050e5389ddc",
"clientId": "26l1v2ngpdcwdtno1wu30rk92dur4",
"ext": {
}
}
]
So my question is how do I add custom fields to the subscribe message (user
, domain
, pid
, sid
etc)? Currently I am subscribing to channels like this:
cometdClient.getChannel("/chat/" + clientID).subscribe(new ChannelListener("/chat/ messages"), new ChannelListener("/chat/ progress"));
But it is failing as expected.
By the way I am using org.eclipse.jetty.client.HttpClient
as the HttpClient.