Phoenix Presence
From the earliest days of Phoenix channels, developers have asked how to tell who is currently subscribed to a channel. Until recently, the answer was to create a custom solution that best fits an individual application’s circumstances. But now, we have Phoenix Presence to solve that problem in a general way for all of us.
Presence has one job to do: to keep track of the clients subscribed to a topic on a channel. For us, that means keeping track of the players in each game. Presence does this amazingly well. This might sound like a trivial task, but it’s deceptively difficult.
If you were to roll your own version of Presence, your first thought might be to maintain a list of the subscribers, adding clients to the list when ...
Get Functional Web Development with Elixir, OTP, and Phoenix now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.