So I have a table of MediaItems and when that list changes, say new entries, I’d like LiveView to know about that so that the Timeline updates automatically. How to know when the table updates? I’ve seen supabase but that appears to be for JS.
I’m just trying to learn LiveView and everything I’ve found about is so far in terms of examples is user-initiated actions changing state rather than server events. In another forum someone recommended looking into Change Data Capture but I think if I followed the CDC path I would get bogged-down in the details of CDC rather than develop the frontend.
Yes thanks I think this is what I was looking for. My presumption is that I can do a broadcast() once I get that table update event. I won’t mark it as “solution” until I implement it though.
If the code/feature doing the original database inserts is part of the same application that is presenting these items in a LiveView, I’d reach for Phoenix.PubSub. You can have your LiveView processes subscribe to a topic for new insertions, and have the area that performs the insertions emit an event on that topic or topics.