Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle presence updates before attaching a document #671

Open
chacha912 opened this issue Aug 8, 2023 · 0 comments
Open

Handle presence updates before attaching a document #671

chacha912 opened this issue Aug 8, 2023 · 0 comments

Comments

@chacha912
Copy link
Contributor

Description:

While it is possible to edit the document.root without attaching a document (with the default actor ID set to 000000000000000000000000), the presence changes is not working as expected. Although a presence-changed event occurs, the presence value is undefined, and user cannot get presence since document is not in an online status. Let's address this case for users who attempt editing before attaching.

const client = new yorkie.Client(testRPCAddr);
await client.activate();
const doc = new yorkie.Document<DocumentType, PresenceType>(docKey);
doc.subscribe('presence', (event) => { console.log('d1 event', event); });

// update presence
doc.update((root, p) => {
  root.k1 = 'v1';
  p.set({ name: 'a' });
});

// and then attach document 
await client.attach(doc, { initialPresence: { name: 'A' } });

Considerations:

  • Is it possible to ignore the initialPresence value when a presence value already exists?
  • Before attachment, the user can be considered offline. Current methods only retrieve presence for online clients, so we may need to introduce a method to retrieve presence including offline clients.

Why: Users can update presence before attaching a document.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Backlog
Status: Todo
Development

No branches or pull requests

1 participant