'fanning out' pub sub broadcasts?
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
But I'd need to get user_ids from
Any ideas?
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}.But I'd need to get user_ids from
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
notify option) and broadcast it yourself