Going from channels to phoenix presence


I am trying to add presence functionality to my chat server. Setting it up with channels was fairly straight forward but I can’t seem to get both messages to appear and for them to persist.

The idea is to keep track of all the messages in lobby, and then have them persist when a new client joins.

Most of my JS logic is here – https://github.com/enilsen16/mychat/blob/add_presence/assets/js/gossip.js
My Room Channel Logic – https://github.com/enilsen16/mychat/blob/add_presence/lib/web/channels/room_channel.ex


To sum up our discussion on slack:

Presence is not a superset of channels. They’re both different tools. Each can be used without the other, or they can be used together.

Presence is not a substitute for a database. The phoenix and elixir core teams both mentioned that persistence is an active area of interest for them at the last elixir conf. However, Presence is not a solution to that problem.