Connecting to a channel for chat app

In the web I found tons of tutorial for chat app but i could nt find any for my specific case. Lets say I have a list of friends and if any of them personally msg me I will see it in real time.

The tutorial I was talking about will already have both the user connected to the channel “conversation:” but in my case, how to do it? Because to connect to a channel, I will have to open the chat box. I hope i am making it clear :frowning:

If I understand the use case correctly, it sounds like you want a notification when one of your friends sends a message? You could check for presence and then send a notification if the recipient is not online right now. At least 3 options:

  • If the user is in the app but not connected to the chat channel, you could use a UI element that listens to the Phoenix channel and displays/links to the chat message.
  • Outside the app, for web apps you could use web push notifications. For mobile apps, there’s an Elixir library.
1 Like