yorkie-team / yorkie

Yorkie is a document store for collaborative applications.
https://yorkie.dev
Apache License 2.0
771 stars 143 forks source link

Add `include_presences` to return active user list in `GetDocument`, `GetDocuments` #976

Open hackerwins opened 2 weeks ago

hackerwins commented 2 weeks ago

Description:

Add include_presences to return active user list in GetDocument, GetDocuments

Currently, CodePair displays document lists using the last modified time from AdminService/GetDocuments. It would be beneficial to include a list of users currently editing documents within this list.

Screenshot 2024-08-24 at 2 09 51 PM

To achieve this, I propose adding an include_presences option to the REST APIs GetDocument and GetDocuments, allowing the return of Presence information alongside the document data. Additionally, while Yorkie clusters shard documents to specific servers, Presence information could be returned without any issues since it only requires read operations.

For reference, Liveblocks offers a similar API at /rooms/:roomId/active_users, and it recommends calling this endpoint with a frequency greater than 10 seconds, which could serve as a benchmark for our implementation.

Why:

This enhancement would enable users to see who is currently editing a document, thereby improving collaboration and transparency during the editing process.