News for hackers. Stuff that matters.
Re:Ask HN: How Can I Make My Front End React to Database Cha... by roshanj on Wednesday April 17, 2024 @09:53AM (#40064628)
You already mention Materialize -- have you looked at the SUBSCRIBE feature? https://materialize.com/docs/sql/subscribe/

It's fairly straightforward to write a websocket endpoint in whatever backend you have that issues a SUBSCRIBE query on connect and then continuously forwards the updates to the client. The complicated parts you'd need to build are on the frontend -- handling updates and merging them into whatever state you render from.

Disclaimer -- I work at Materialize -- but it does seem like the perfect fit for what you need (efficiently updated real-time materialized views).

Re:Ask HN: How Can I Make My Front End React to Database Cha... by bruchim on Thursday April 18, 2024 @04:03AM (#40074006)
Thanks! > It's fairly straightforward to write a websocket endpoint in whatever backend you have

It indeed solves half of the problem, but managing websockets for thousands of users is not that trivial IMO

Re:Ask HN: How Can I Make My Front End React to Database Cha... by fernandotakai on Friday April 19, 2024 @07:12AM (#40085354)
you should try phoenix channels https://hexdocs.pm/phoenix/channels.html

they scale really really easily for millions of users.