> Hmm, we definitely need to add support for wildcards. There's already
> a ChannelName class that should work for this means and I see you've
> created a ChannelPattern one (which I've not had time to look at yet)
> is this doing a similar thing?
Yeah, sort of. The difference is that ChannelName stores channel name
and matches against various patterns, while ChannelPattern stores
pattern and matches against multiple names. The second is what you
need for the wildcard support, and it allows the class to be more
efficient at the matching.
> Now I'm not too sure that we want to try to optimise the storage of
> subscriptions within the framework itself. I would like the scope of
> AspComet to remain very focused on solving the messaging between
> browser and server and implementing the Bayeux protocol (at which it's
> still far from perfect).
>
> There is a fairly generic interface
> IClientRepository.WhereSusbribedTo("channel") which is used internally
> for publishing messages to clients subscribed to channels, so an
> application could provide its own ClientRepository with a more
> optimised way of doing this, but I think each application will want
> their own way of doing it, depending on the context, maintaining the
> relationship between channel and client internally or in some database
> or distributed cache.
I didn't want the special storage for some advanced app usage, but for
sending message to all clients subscribed to a given channel, which I
think is quite a core functionality of the server? After all, even
ForwardingHandler needs it.
I know we have the WhereSubscribedTo method which handles it
currently, but the way is not very effective - if you imagine 1000
clients and say 20 channels, then every message going to one of the
channels have to go through all the 1000 clients (and potentially
multiple subscriptions per client). And that's gonna be even worse
when IsSubscribedTo will have to do the wildcard matching.
I know I can always implement it as customization of the
InMemoryClientRepository/Client classes, but I thought it's probably
useful for all the uses of the server.
> As an aside I would really like to avoid the framework taking any
> locks of any kind unless completely necessary, and leave it up to
> applications to manage synchronisation.
Yes I agree, but if the storage is implemented as part of the server,
we have to expect the possibility that 2 clients write to it at the
same time (subscribe/unsubscribe)