Best practice around handling channel subscriptions

Howdy,

I’m getting started with Phoenix and want to build a public transit application. In this application, one can subscribe to their favorite public transit stops and then receive real-time notifications of service updates etc.

One question during the design of the application that came up was how to deal and potentially manage the subscriptions of the channels. I.e if I have a list of updates for various transit stops, do I just push out the messages to their respective channels and let Phoenix manage how those messages get to the users (and which messages don’t have any subscriptions), or do I keep track of which stops the users have subscribed to and then push it out to them specifically.

I get that this is somewhat depending on the ratio of number of stops that receive updates against the number of stops that users have actually subscribed to, but I wonder if there are general best practices or known limitations of effectively using the phoenix channel router to fan out the messages automatically

1 Like