I'm looking for a clean approach for 'fanning out' pub sub broadcasts based on relationships.
For example, if I have: * teams * team_members - team_id, user_id * users * subscriptions - team_id
If a subscription changes, maybe I'd want to broadcast to all users in that team, with a topic like
subscriptions:#{user_id}
subscriptions:#{user_id}
.
But I'd need to get user_ids from
subscription.team.team_members.user_id
subscription.team.team_members.user_id
, not a direct attribute on subscriptions.
Any ideas?
Solution
I don't think there is any great way to do this declaratively right now. You can add a custom notifier that gets each notification (its just a module that implements the
The Elixir backend framework for unparalleled productivity. Declarative tools that let you stop wasting time. Use with Phoenix LiveView or build APIs in minutes for your front-end of choice.