Tracking users statuses using Presence

To finish this chapter, we'll take a quick look at how we can add a list of online users to our application, and in the process demonstrate how easy it is to accomplish this using Phoenix Presence. This feature was released in Phoenix 1.2 and is built on top of Phoenix PubSub and Channels. Phoenix Presence allows us to register process information on a topic, which is replicated transparently inside a cluster.

One of the special feature of Presence is that there's no single point of truth, and consequently there's no single point of failure. Whereas, in other programming languages, you'd likely use a database (or some other central component) to store the status of each user, Phoenix Presence implements ...

Get Mastering Elixir 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.