uklance / tapestry-cometd

A push library for Tapestry5 based on CometD
17 stars 3 forks source link

Investigate removing topic / channelIds map in CometdGlobals #33

Closed uklance closed 12 years ago

uklance commented 12 years ago

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

uklance commented 12 years ago

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.