Handling Presence Information and Notifications across many channels in a Messaging App

I’m currently working on a Slack/Discord style messaging clone to get acquainted with Phoenix. I’m currently building out the notifications system so users can receive new messages on other channels and servers. This had led me to the question of how many joined channels are appropriate on the client side. Hypothetically, using Discord’s limits a user could be part of 100 servers each of which have a maximum of 500 channels. This theoretically means that a user is part of 5000 channels and I’m not sure if its okay to actually join all of them. I was thinking instead of using channel level events you could use server level events in which case you’d only need to connect to 100.

Is 100 or 5000 client-side channel joins reasonable? I understand these are just stored in a lightweight structure but I’m wondering if this is the most efficient or idiomatic way to solve this problem.

1 Like

I think I have a handle on this problem so I’ll share my changes. Instead of trying to join the channels manually on the client side I instead simply subscribe to them from a user channel. Each unique user has their own channel which subscribes to all the message rooms they’re a part of regardless of whether they’re a direct messaage or a dm using:


Presence is handled at the same time by simply invoking

Presence.track(self(), topic, meta)

This allows the client to subscribe to a single channel and get all necessary background message notifications. When actually navigating to a room, I’m using Graphql subscriptions which override the background events in the channel.