pasanbsb
pasanbsb

Reputation: 445

deliver data to cometd server using a channel

How can I deliver some data to server side while subscribing to server?

As an example,

When I subscribing /alert/12345, I want to send some other information such as alert_type, date_time etc to CometD server.

Upvotes: 0

Views: 181

Answers (1)

lance-java
lance-java

Reputation: 28081

You can pass a data map in subscribe:

cometd.subscribe(channelId, undefined, callback, { data: data })

But as far as I could see, you can only get a reference to the data map in org.cometd.bayeux.server.Authorizer. I couldn't get it via org.cometd.bayeux.server.BayeuxServer.SubscriptionListener because there is no reference to the ServerMessage.

You can see my use of it here:

Upvotes: 2

Related Questions