Closed basilkohler closed 9 years ago
Alright, did some more digging and I did not get it quite right. Messages are braodcasted to all subscribers of a redis channel. So I think it is not possible to filter out certain instances depending on the user. It must be the other way: create a filtered channel meeting all criterias and only let users subscribe who are allowed to see messages with these criterias. And this is basically how swampdragon handles channels already. Can be closed if i am still not overlooking something.
Another btw: it would be very helpful if the documentation contains a couple of sentences or one page regarding the high level architecture of swampdragon, especially for those who do not have a lot of experience with redis and/or tornado.
Happy to hear you sorted it. Yes the documentation should be rewritten (so much to do, so little time).
I'll close this issue and open a new one about the documentation.
I'm writing a custom router mainly to be able to use the django rest framework serializers directly (mostly pushing full complete instances). I don't want all instances of a model to get published, in certain cases modified instances should not be published at all. If i grok'ed it correctly, 'get_subscription_contexts' enables filtering in such a way that instances that do not pass the test are serialized as 'deleted'.
However, that is not my issue and I implemented something for my use case. My main issue is that I need to access the connection associated with subscribers of channels, because the connection contains the auth'ed users.
How do I get hold on the connection objects from the 'outside' of a router? (I cannot simply instantiate a new router because it requires said connection...) I tried to follow the call chains but I always get lost at one point... One solution would be to just store the mapping of subscribers to specific channels in the subscribe method in the router, but my feeling is that this information is somewhere accessible and reliable?
Btw, thanks for the awesome work! It seems to be more or less the only active, python3 project to easily get websocket support for django...