Live data from Hacker News

Rxdb: A reactive database where you can subscribe to the result of a query

github.com

51–60 of 126 posts

Re: Rxdb: A reactive database where you can subscribe to the result of a query

#51
post #30

If you want to subscribe to changes in a Postgresql database, whether produced by your app or not, you can also use Hasura or PostGraphile: https://docs.hasura.io/1.0/graphql/manual/subscriptions/inde... https://www.graphile.org/postgraphile/realtime/

I tried out Postgraphile Realtime and it's pretty cool. For anyone who wants something similar that's not GraphQL, then I'm in the early stages of developing a Phoenix (Elixir) implementation which broadcasts changes over websockets: https://github.com/supabase/realtime See comments here: https://news.ycombinator.com/item?id=21354039

Neat; happy to have inspired you!

Re: Rxdb: A reactive database where you can subscribe to the result of a query

#52

Having client state just be a replica of server state solves so many problems I don't understand why the concept never caught on. Pouchdb/couchdb are still the only ones doing it afaik. Instead we have a bajillion layers of CRUD all in slightly different protocols just to do the same read or write to the database.

Security is a huge deal

Re: Rxdb: A reactive database where you can subscribe to the result of a query

#53

Earlier quoted context omitted.

I tried out Postgraphile Realtime and it's pretty cool. For anyone who wants something similar that's not GraphQL, then I'm in the early stages of developing a Phoenix (Elixir) implementation which broadcasts changes over websockets: https://github.com/supabase/realtime See comments here: https://news.ycombinator.com/item?id=21354039

Neat; happy to have inspired you!

You did Benjie! Postgraphile is really an awesome piece of tech. I use PostgREST a lot, and I see graphile as an awesome graphql equivalent.

Re: Rxdb: A reactive database where you can subscribe to the result of a query

#54
post #45
post #10

Earlier quoted context omitted.

When your data is public and immutable, this approach is very pleasant. The client becomes just another caching layer and worst case it's presenting a historical version of the truth. You can even extend this across tabs with things like local storage. This breaks down quickly once you have data that could become private or mutate rather than append.

In reality data can't become private again, after being available. You may try to contact all users to delete their copy, but they may not respect that.

That's in theory. In actual reality, if you're making an app that has private data and is not crawled by bots, most of the time users don't save everything that they see.

Re: Rxdb: A reactive database where you can subscribe to the result of a query

#55
post #40

Earlier quoted context omitted.

“Real-time” in JS tends to refer to approaches like websockets.

So it's not really realtime... No ? I noticed an instant downvote. It's not the first time i see this behavior on rxdb comments.

The definition of realtime is vague so saying that something is "not really realtime" just because it is not "realtime computing" is wrong.

Re: Rxdb: A reactive database where you can subscribe to the result of a query

#56

Having client state just be a replica of server state solves so many problems I don't understand why the concept never caught on. Pouchdb/couchdb are still the only ones doing it afaik. Instead we have a bajillion layers of CRUD all in slightly different protocols just to do the same read or write to the database.

That's exactly the model that Apollo Client library uses (GraphQL-based data store for react), and teams I spoke that tried it are quite enthusiastic for this reason.

Re: Rxdb: A reactive database where you can subscribe to the result of a query

#57

I'm not sure why you would use this over something more battle-tested like RethinkDB which was also built with this use-case in mind.

Because rethinkdb development has ceased? Last release was in 2017. Is there still maintenance?

The community has taken it over as far as I know. Looking at the github there appears to be some active development still. https://github.com/rethinkdb/rethinkdb

Re: Rxdb: A reactive database where you can subscribe to the result of a query

#58

Having client state just be a replica of server state solves so many problems I don't understand why the concept never caught on. Pouchdb/couchdb are still the only ones doing it afaik. Instead we have a bajillion layers of CRUD all in slightly different protocols just to do the same read or write to the database.

> Having client state just be a replica of server state solves so many problems I don't understand why the concept never caught on.

As soon as your server state is larger than whatever your client can handle, the whole metaphor breaks down.

Re: Rxdb: A reactive database where you can subscribe to the result of a query

#59
General question about reacting to database events: It seems like when responding to DB events it would be easy to accidentally create an infinite loop. Is that an issue with this pattern, or is it easy to avoid? Do any of these data subscription tools have safeguards in place to prevent this?
Post reply on HN