Live data from Hacker News

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

github.com

21–30 of 126 posts

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

#21
post #13

Meteor do this since inception with MongoDB on server and MiniMongo in client.

Yes, mongodb and meteor and minimongo do something similar but with much more restrictions on what you can do.

RxDB does exactly one thing which is being a client side database. You are not tied to a specific ecosystem or backend database.

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

#22
This is something Realm does really well, both locally on the device and also with live subscriptions to data in the cloud.

We used this for our mobile apps and the experience was pretty awesome. The ability to live observe both individual objects in the dB and results of queries makes building reactive UI’s a very pleasant experience.

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

#24
I was complaining about lack of such a database just today: https://news.ycombinator.com/item?id=21352235

I'm not doing field projects anymore but knowing this exists would have helped me tremendously in the last few years.

Thanks for sharing!

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

#26
post #4

Earlier quoted context omitted.

How would that work, with, say Twitter? Copy all tweets ever to each browser? I mean, that's why it didn't catch on right :-) It's hard :-)

Same way you scale replication for any server, by sharding and only replicating the shards you care about. The "shard" could just be that users own feed in this case. Then you get offline for free where user adds a tweet and it appears immediately, replicating back to server when he goes back online. The server replica side will need to be a lot more complicated to deal with broadcasting but I don't see why it won't…

I attempted something similar on a current project, the problem is with inital data loading. If you are hitting the URL/Page for the first time you are waiting minutes or more for non trivial data sets.

Why not just load what is needed and hydrate the data over time? What about datasets where you need pagination/ordering etc. And the only way to guarantee order is to pull the whole set?

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

#27
If you want a change-stream out of your regular MySQL or PostgreSQL database systems, check out Debezium: https://debezium.io/

It basically registers itself as a fake replica server so that it can get updates from the master (like binlog in case of MySQL) and then it forwards those updates to Kafka. The possibilities are endless what you can do with those updates as Kafka consumers.

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

#28

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.

> RxDB can do a realtime replication with any CouchDB compliant endpoint and also with GraphQL endpoints.

PouchDB is mentioned a couple of times, including one “PouchDB compatible” mention. Wondering what unique use cases RxDB supports?

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

#29
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.

This what stopped me exploring couchdb further. The "one db per user" model for private data made using other features like views etc more difficult when you have to upgrade,edit,remove them. Mutability wasn't really a problem, either present the conflicts to user and pick one or write code to merge if possible.

Couchbase (with its sync gateway) uses "channels" to sync data. It even lets you change the channel of a doc, and to the sync client it shows as if the doc was deleted (if the user is not part of the new channel)

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

#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/

Post reply on HN