4 ms·
In 2016, I built a PWA that can synchronize using two different backends: AWS if the user doesn't care where the data is being saved to or WebDAV (in my case, a
by arendtio 2y ago
In 2016, I built a PWA that can synchronize using two different backends: AWS if the user doesn't care where the data is being saved to or WebDAV (in my case, a Nextcloud instance). Sadly, I built it in prototype style and didn't take the time to fix/rebuild things properly.
But I have used this app every week since, and one of the lessons is that operations-based files grow pretty quickly. If you want to keep sync times short and bandwidth usage to a minimum, you have to consider how you keep read and write times to a minimum. I use localStorage for the client-side copy, and reaching the 5 MB quota isn't that hard either. These things can be solved, but you have to consider them during the design phase.
So yes, it's cool stuff, but the story isn't over with using automerge and op-based files.
- jitl 2y agolocalStorage is pretty bad, we saw lost writes under contention from different tabs in all browsers and stopped using it for write-path user data in 2019. IndexedDB is annoying but more trustworthy. With op sync you can compact & GC old ops past some temporal or data size threshold. Say, if the file reaches $LIMIT mb, compact and drop old ops past $OLDEST_OP_DATE when the limit is hit. If you receive edits from before the cutoff, fork the file since you can’t merge them without conflict.