The "topic" abstraction was created so that multiple PushTargets could subscribe to the same topic but apply a different event / formatting to the result.
I'm starting to think that it is possible to achieve this without storing a map of topics to channelIds in CometdGlobals. I still need to think about this a bit more but I think that this could be achieved by using wildcards in channelIds.
let's assume we have the "/chat" topic and two components on a page might listen to channelIds:
"/chat/pushtarget_1"
"/chat/pushtarget_2"
On the serverside, I could lookup the channels for "/chat/**" and then iterate through the subchannels
Unfortunately, the CometD API's don't have a link from a wildcard channel to it's subchannels so we need to store tha map ourselves. Another possibility is walking all the channels but this has O(N) performance.
The "topic" abstraction was created so that multiple PushTargets could subscribe to the same topic but apply a different event / formatting to the result.
I'm starting to think that it is possible to achieve this without storing a map of topics to channelIds in CometdGlobals. I still need to think about this a bit more but I think that this could be achieved by using wildcards in channelIds.
let's assume we have the "/chat" topic and two components on a page might listen to channelIds:
On the serverside, I could lookup the channels for "/chat/**" and then iterate through the subchannels
https://github.com/uklance/tapestry-cometd/blob/master/src/main/java/org/lazan/t5/cometd/services/internal/CometdGlobalsImpl.java