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
I like it! https://daneden.github.io/animate.css For those of you who visited hello.forum.devtalk.com you’ll have seen it in action on ...
New
AstonJ
Here’s a pretty good list of them: https://github.com/jashkenas/coffeescript/wiki/List-of-languages-that-compile-to-JS What’s your favou...
New
AstonJ
Inspired by @dbernheisel’s post here, which CSS framework do you use and why?
New
DevotionGeo
Dart is not the first language with that mistake, but it’s newer. It shouldn’t have repeated this mistake.
New
First poster: bot
The Analytics That Matter | CSS-Tricks. I’ve long been skeptical of quoting global browser usage percentages to justify their usage of b...
New
AstonJ
Which WebAssembly language/s interest you? I just discovered AssemblyScript (portal | thread) which looks interesting! Here are some of...
New
AstonJ
Wondering if anyone has any thoughts on choosing between these two languages for WebAssembly? I definitely want to explore wasm, and rea...
New
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
guaip
I’ve been doing front-end as a freelancer for 15 years. I have some PHP background and still do some backend stuff to this day, but I spe...
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
New
AstonJ
This looks like a stunning keycap set :orange_heart: A LEGENDARY KEYBOARD LIVES ON When you bought an Apple Macintosh computer in the e...
New
PragmaticBookshelf
“Finding the Boundaries” Hero’s Journey with Noel Rappin @noelrappin Even when you’re ultimately right about what the future ho...
New
Exadra37
I am asking for any distro that only has the bare-bones to be able to get a shell in the server and then just install the packages as we ...
New
PragmaticBookshelf
Author Spotlight Mike Riley @mriley This month, we turn the spotlight on Mike Riley, author of Portable Python Projects. Mike’s book ...
New
New
PragmaticBookshelf
Author Spotlight: Karl Stolley @karlstolley Logic! Rhetoric! Prag! Wow, what a combination. In this spotlight, we sit down with Karl ...
New
AstonJ
This is cool! DEEPSEEK-V3 ON M4 MAC: BLAZING FAST INFERENCE ON APPLE SILICON We just witnessed something incredible: the largest open-s...
New
Fl4m3Ph03n1x
Background Lately I am in a quest to find a good quality TTS ai generation tool to run locally in order to create audio for some videos I...
New