Updating Notifications in Real Time
For real-time goodness, our NotificationsLive liveview needs some way of finding out when new Notification records are created. For this, we can turn to a publish/subscribe mechanism, also known as pub/sub (or pubsub). The Notification resource will publish updates for every action that we set it up for, with a given topic name, and then the liveview can subscribe to that topic to receive the updates and update the page with the new notification details.
Phoenix has a pubsub adapter[193] built into it for use with features like channels[194] and presence.[195] Ash also comes with a pubsub notifier[196] that works with Phoenix’s pubsub (or any other pubsub) to let us set up systems that can respond to events ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access