LiveView's reliance on server-rendered HTML and leveraging of bi-directional communication over WebSockets means that we can build resilient and highly scalable real-time features almost entirely in Elixir––without writing any of our own JavaScript. It's no wonder that developers are starting to flock to LiveView to support things like user notifications, form validations, application monitoring, autocomplete, and more.
However, as we use LiveView for more and more real-time features, we will naturally reach for the other real-time functionality that Phoenix has promised us: user tracking and message broadcasting. What happens, for example, when our real-time markdown editor needs to support collaborative editing à la Google Docs? Do we eschew LiveView and return to Phoenix Channels and Presence? Do we incorporate LiveView into a page that is already backed by these other technologies?
Nope! Thanks to the flexibility of Phoenix's PubSub and Presence libraries and their reliance on OTP principles, we can seamlessly incorporate these technologies directly into our live views. In this talk, we'll learn how to use LiveView together with Phoenix PubSub and Presence to support real-time message broadcasting and user activity tracking across a set of clients.
Sophie is a software engineer and educator at The Flatiron School, where she uses Elixir to deliver unique and robust tools to students learning how to code. She loves writing code and writing about code on her blog and for Elixir School, a free, open-source Elixir curriculum maintained by a dedicated group of devs around the world. When she's not coding, you can find her in Brooklyn, letting her dog eat way too many treats.