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.

Popular Frontend topics Top

malloryerik
Any thoughts on Svelte? Svelte is a radical new approach to building user interfaces. Whereas traditional frameworks like React and Vue...
New
AstonJ
Sprinkles of JS, or full frontend frameworks? What do you use and why?
New
First poster: bot
Seed 0.8.0 has been released. Link: Release 0.8.0 · seed-rs/seed · GitHub
New
First poster: bot
Fable 3.0.2 has been released. Link: Release 3.0.2 · fable-compiler/Fable · GitHub
New
First poster: bot
Hotwire is an alternative approach to building modern web applications without using much JavaScript by sending HTML instead of JSON over...
New
New
First poster: bot
A new Angular blog post/announcement has been posted! Get the full details here: http://blog.angular.io/build-more-accessible-angular-...
New
The_Exile
I am new to programming. I started reading Eloquent Javascript 3rd Edition, as the book comes highly recommended as a good place for beg...
/js
New
pillaiindu
I mean, when you render all the HTML at the server side and the data is sent through HTTP requests, except only if some tiny things are d...
New
Fl4m3Ph03n1x
Background I have a button that may be disabled or not, depending on a set of conditions. I want to disable/enable the button without hav...
New

Other popular topics Top

ohm
Which, if any, games do you play? On what platform? I just bought (and completed) Minecraft Dungeons for my Nintendo Switch. Other than ...
New
DevotionGeo
I know that these benchmarks might not be the exact picture of real-world scenario, but still I expect a Rust web framework performing a ...
New
AstonJ
You might be thinking we should just ask who’s not using VSCode :joy: however there are some new additions in the space that might give V...
New
AstonJ
poll poll Be sure to check out @Dusty’s article posted here: An Introduction to Alternative Keyboard Layouts It’s one of the best write-...
New
dimitarvp
Small essay with thoughts on macOS vs. Linux: I know @Exadra37 is just waiting around the corner to scream at me “I TOLD YOU SO!!!” but I...
New
AstonJ
In case anyone else is wondering why Ruby 3 doesn’t show when you do asdf list-all ruby :man_facepalming: do this first: asdf plugin-upd...
New
mafinar
Crystal recently reached version 1. I had been following it for awhile but never got to really learn it. Most languages I picked up out o...
New
AstonJ
Continuing the discussion from Thinking about learning Crystal, let’s discuss - I was wondering which languages don’t GC - maybe we can c...
New
rustkas
Intensively researching Erlang books and additional resources on it, I have found that the topic of using Regular Expressions is either c...
New
husaindevelop
Inside our android webview app, we are trying to paste the copied content from another app eg (notes) using navigator.clipboard.readtext ...
New