I’m making a project where users can talk in a chat application and I’m trying to understand Phoenix Channels.
As of now, the only real-time feature planned is the chat. But I may consider having a notification system (if someone mentions you, or sends you a direct message for example)
Are there advantages or disadvantages in having a single channel for several of your real-time features? Would it be better to create another phoenix channel for notifications and have the first channel communicate to the second one?
Unless you go through some work proxies or so that can limit it to 1 websocket connection per server (hence why my server is built to put everything over just one).
Plus it uses fewer server resources (not much, but still).
Yea, this is generally a good idea. It should lead to smaller Channels that could be composed more easily.
I recommend looking at a new Socket when your authentication needs change. For instance, a user portal has different authentication needs than an admin portal. I would have a Socket for the admins and then one for the users. If I had a feed:user_id topic, I would probably put that in the same Socket, different Channel, as the notifications:user_id topic.