ianI
Convex Community2y ago
7 replies
ian

Bandwidth usage for collaborative editing

I was thinking about delta-based protocols with our current subscription paradigm. If you have a sequence of edits that you apply to make a document, you could do something like:
1. Have multiple documents for the deltas - maybe one document per delta is ok, or maybe you batch them.
2. Have the query for the document be a paginated query, not a single query for the whole thing.
3. To render the document, the client fetches all pages, and automatically fetches new pages. The deltas -> doc transform can then happen on the client, and you can optimistically apply your own deltas without duplicating server logic.
4. As your document deltas grow, you can occasionally have a "snapshot" document that has the whole document as a single delta, so your "full doc deltas" query becomes a "all deltas since the last snapshot". You can make this snapshot after some threshold, when a user leaves the page, whatever heuristic makes sense.

If you want to keep discussing, maybe we grab a #support-community thread? I know @RJ has worked deeply with things like this for his show-and-tellScroll app which uses tiptap iirc
Was this page helpful?