Decouple Centrifugo specific channel namespace configuration from library core
FZambia opened this issue · comments
At moment Centrifuge library follows Centrifugo in terms of subscribe and publish permissions. While this is fine for Centrifugo - having namespaces and predefined channel rules inside a library can be a bit confusing for users.
What I want to achieve with this library is make it only a reasonable wrapper over client-server protocol without many opinionated logic on top of it. I.e. give developers a possibility to define their own channel rules and permission checks.
Another confusing thing in my opinion is that if we don't define On().Subscribe()
handler then client will be able to subscribe on all channels. I believe the default behaviour should be: not allow subscription at all if subscribe handler not set for connection.
That said I'd want to decouple namespace and channel permission logic from Centrifuge library core since it adds a very opinionated layer to library. Maybe this process will also require decoupling JWT parsing logic too.
Can't wait for this. Can you make it so we can pass some kind of context for the client? Eg: context.Context that can be returned from ClientConnecting and we get it in ClientConnected, or maybe a simple map in the Client struct that can be freely modified, or anything like that. During Subscribe, it would make it much simpler to use headers/host name/result of custom auth from ClientConnecting/etc.
Context
already propagates to ClientConnected
handler and you can modify it in ClientConnecting
- this behaviour will stay the same in new version. See
Line 20 in 116c717
Context
you can return from ClientConnecting
after putting some additional data into it. Is this what you mean or I did not understand right?I missed that, cool. Looking forward to the changes then :)
Merged #129 to master, hope to create v0.10.0 release tag tomorrow
Done in v0.10.0