michael

michael

Detecting Postgresql Table Change for LiveView

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.

Most Liked

Exadra37

Exadra37

You use Phoenix PubSub to broadcast them each time you create, update or delete them.

Then in the handle_info on your live view you can use send_update/2 to update the client.

Some useful links:

dimitarvp

dimitarvp

You are looking for Change Data Capture which goes well beyond the scope of PostgreSQL. If you can achieve CDC with your DB then you should be able to pretty easily propagate events to any other frontend/backend system, LiveView included.

michael

michael

Hi thanks for the reply because I never heard of CDC before(probably because when it comes to backend development I’m just a novice). I do think though that CDC goes way beyond the scope of what I’m looking for. 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. I think if I followed this CDC path I would get bogged-down in the details of CDC rather than develop the frontend.

Where Next?

Popular Frontend topics Top

AstonJ
Sprinkles of JS, or full frontend frameworks? What do you use and why?
New
First poster: bot
React is Dead. Long live Reactive Rails! Long live StimulusReflex and ViewComponent!. Let me tell you about the feeling that I get when ...
New
mafinar
Just like I did one on Tailwind some time ago, I am going to play with AlpineJS the next few days. It’s a nice little JS framework that ...
New
ClaudiaGiv
Hi all, I recently started working with Svelte and created a small app with SvelteKit in order to understand better the framework. I hav...
New
First poster: bot
Interactive periodic table showing names, electrons, and oxidation states. Visualize trends, 3D orbitals, isotopes, and mix compounds. Fu...
New
EngineerHamziey
Hello everyone, is there a website or app that I can use to improve my self Like where there are UI UX designs to practice with and then...
New
KnowledgeIsPower
It seems it is going to change, currently they forked Next.JS. Now they want to stop forking it and change their project direction.
New
Fl4m3Ph03n1x
Background I am trying to recycle myself and improve my knowledge about Phoenix. With 1.7 now out, this seems like a good opportunity. ...
New
riyajohnson
When it comes to selecting a framework for a development project, it’s crucial to make an informed decision. With so many options availab...
New
vinay003
When it comes to integrating messaging features into super apps, you’ll want a reliable and efficient solution. Here are some top SMS API...
New

Other popular topics Top

Devtalk
Hello Devtalk World! Please let us know a little about who you are and where you’re from :nerd_face:
New
AstonJ
If it’s a mechanical keyboard, which switches do you have? Would you recommend it? Why? What will your next keyboard be? Pics always w...
New
Exadra37
Please tell us what is your preferred monitor setup for programming(not gaming) and why you have chosen it. Does your monitor have eye p...
New
AstonJ
I ended up cancelling my Moonlander order as I think it’s just going to be a bit too bulky for me. I think the Planck and the Preonic (o...
New
Rainer
Not sure if following fits exactly this thread, or if we should have a hobby thread… For many years I’m designing and building model air...
New
foxtrottwist
A few weeks ago I started using Warp a terminal written in rust. Though in it’s current state of development there are a few caveats (tab...
New
mafinar
This is going to be a long an frequently posted thread. While talking to a friend of mine who has taken data structure and algorithm cou...
New
PragmaticBookshelf
Author Spotlight: VM Brasseur @vmbrasseur We have a treat for you today! We turn the spotlight onto Open Source as we sit down with V...
New
PragmaticBookshelf
Programming Ruby is the most complete book on Ruby, covering both the language itself and the standard library as well as commonly used t...
New
First poster: bot
zig/http.zig at 7cf2cbb33ef34c1d211135f56d30fe23b6cacd42 · ziglang/zig. General-purpose programming language and toolchain for maintaini...
New