i need to think some more about whether or not programmatic filtering is necessary. my tendency is to lean towards it being necessary but i also think that i'm probably biased by my natural inclination - i bet you'd find a way to avoid it :) although, i suspect it may cause you to expose some better extension mechanisms.
in the most common case i need to restrict a client when they subscribe to object/*. as an example, if a user belongs to a certain group, they may be able to receive notifications about "draft" objects belonging to that group but users who are not a part of that group should only be notified of changes to things which have a "published" status in that group. in the more complex case, i might want to explore the idea of letting the client provide a query to indicate which objects they want notifications about. as a user moves through the UI, the client may subscribe and unsubscribe to relevant queries in order to reduce the number of notifications received. at this time, that's just a thought to experiment with and i don't know if it's more of a burden on the server just to do the filtering and reduce the amount of HTTP interaction compared to just sending everything to the client to do the filtering. so, i guess there's 2 general categories of filtering i may want to accommodate - permissions-based filtering and query-based filtering.
i think i may have been led to trying to do permissions-based filtering in the facet because the logic to restrict get, query, put, etc all exists in the facet and so my inclination was to put the subscribe/publish logic in there too. i can see how the hub code lends itself to the channels/topics architecture you described but as you mention, extension points and protocols (and non-trivial examples) are lacking.
while i think some more about this, am i right to assume that tunguska does not require sticky sessions? if i'm understanding correctly, the clientId is what allows a client to connect to any server in a cluster. at this time, i'm only running from 1 CPU but i want to make sure that whatever way i approach this filtering i don't limit myself in other ways. i can see now that trying to intercept the subscribe method of a facet would require sticky sessions - a connection would need to call subscribe on this server instance in order for filtering to be applied via the subscribe method. instead, i'm thinking that i could introduce some jsgi middleware that gets the clientConnection before pintura/media/message/json tries to send to it and replace clientConnection.send with a function that applies my filtering. i know this isn't in line with the architecture you describe but it seems like the path of least resistance right now and i just wanted to get your feedback regarding what i might lose by doing that.
on a side note, i really would like to see life breathed back into persevere and i'd love to do what i can to help. if there are any plans in the works feel free to send pieces my way. i feel like if i could get inside your head i could provide some of the effort required. i would probably do more if i had some clear direction - e.g. i could probably close, merge, or update some of the open PRs if i knew your thoughts on them. i've had to make a number of changes to parts of persevere and introduce some custom middleware in my app and i'd be glad to contribute these things but i sometimes don't know whether my changes are needed due to my lack of understanding or if there really is a bug.
thanks,
ben...