feathers-plus / feathers-offline-realtime

Offline-first realtime replication, with optimistic updates while connected.
MIT License
33 stars 9 forks source link

Missing things, that came up during evaluating this solution for my app #16

Closed RobIsHere closed 3 years ago

RobIsHere commented 6 years ago

I'm evaluating the offline realtime solution for my new react native app. I would like to let you know about some things I came about. Maybe they are already solved without me realizing that.

The things that I'm missing are:

I think many of these are common things. Hope it helps.

eddyystop commented 6 years ago

Thanks.

I do plan to return to these repos at some point but I'm focused on other Feathers issues.

Do feel free to submit PRs for any of points 1, 2, 4, 5, 5a.

RobIsHere commented 6 years ago

In the docs I found: "Once the queue is processed, a snapshot refreshes the client's replica, bringing it up to date".

My snapshots would grow to MBs over time. So I'm thinking about a solution, that doesn't transfer the whole snapshot again and again.

Is there another plan, maybe to also have a kind of transaction log on the server for the downward sync? Very interested in your opinion about this...

eddyystop commented 6 years ago

The roadmap includes replication syncing of multiple instances of the same logical file. That gets complicated when many clients can replicate/mutate the same DB. That could be used as an alternative to snapshots.

I don't want to mislead you: that won't be addressed any time soon. There is months of work for the new Feathers release, for rolling out a much faster populating hook, for new common hooks, for rolling out the new GraphQL adapter with code generation. Only then could I think of returning to working on offline.

If you plan to implement this yourself, hopefully each file containa only data for a single user, as a log is then striaghtforward.

If the files are shared by multiple users, then hopefully they are read only. The server could keep a log of mutations organized by a replication-counter. Each client would keep the last replication-count it synced with, and would ask the server for all mutations with larger replication counters. (Many details.)

If the files can be mutated by any of the clients, then each client must also keep a log of its mutations with its own replication-counter. Then the client must first sync its transactions to the server, before the server syncs with it. (Many more details.) The client needs its own replication counter as it may be mutating its records while its also syncing previous mutations with the server. That sync could fail and I found being able to keep the mutations separate was useful.