Tracking Presence on a Channel

Let’s track which users are watching a video. This problem may seem easy on the surface, but it’s a notoriously difficult computer science problem when multiple servers are involved. The users may be stored in different places, and we’ll need to access them. We’ll also need to clean up the data when users disconnect. If the connections between servers fail, we’ll need to make some decisions about how to calculate and present exactly who is present.

Luckily, we won’t have to solve any of these problems because we can rely on Channel Presence to solve them for us. When we’re done, we’ll have no single point of failure and no single source of truth, an excellent attribute for a distributed solution. Since the entire ...

Get Programming Phoenix 1.4 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.