News for hackers. Stuff that matters.
Re:Ask HN: How Can I Make My Front End React to Database Cha... by austin-cheney on Thursday April 18, 2024 @06:35AM (#40074757)
Do it the way the database wants you to do it. Don’t use HTTP. Instead use TCP sockets (WebSockets when in the browser). Then put a tigger on the tables you care about.

Every time the table changes the DB sends a message to the browser in real time. Super simple.

Re:Ask HN: How Can I Make My Front End React to Database Cha... by bruchim on Thursday April 18, 2024 @06:48AM (#40074840)
It's super simple for a simple demo app, not easy for a large scale.
Re:Ask HN: How Can I Make My Front End React to Database Cha... by austin-cheney on Thursday April 18, 2024 @08:06AM (#40075319)
It remains just as simple. The transmission model does not change as the size of application code changes.

The only thing to worry about is load balancing socket restoration when the server recovers from an outage so it’s not overwhelmed reopening all sockets simultaneously.

As for the database side you should only be concerned with changes to a select few tables and not the entirety of data. That could also be centrally managed with a script.