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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.