lud
Multi tenancy with Phoenix Channels
Before diving into the code to try to understand how the full system works, I want to know how hard it would be to make websockets & channels work with multiple pubsub servers.
Basically, the idea is to allow different clients to use their own channel names. Currently we have the client ID as a prefix to the channel name : "jwp:<client_id>:<name>" so we can direct connexions to our channel implementation (matching "jwp:*"). As the channel name is unique, it works well and different app do not have other apps messages. This is with the default Phoenix 1.5 setup.
Now, with multiple pubsub servers, it would be easyier to provide different channel implementations like "public:*", "private:*", "presence:*", "state:*".
I guess I can hack it some way, but is there a good way of doing it ? And how would it behave with distribution ?
Thank you.
Most Liked
sb8244
The second post isn’t clicking for me. If the topic has the client_id in it, you can authorize that they are allowed to join/3 the channel, based on the socket state and the channel topic name. You authenticate in the socket connect function, and authorize in the channel join function based on the topic and assigns state.
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance









