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

join or create message? #4

Open
jonasfj opened this issue Oct 4, 2015 · 3 comments
Open

join or create message? #4

jonasfj opened this issue Oct 4, 2015 · 3 comments
Labels

Comments

@jonasfj
Copy link
Contributor

jonasfj commented Oct 4, 2015

Looking at the clientside API, it's really hard to:

  • see why you a join failed not allowde, internal error, or document doesn't exist
  • It's also impossible to create a document with a specific id

I propose we add a method to join-or-create a document with a given id.

@jonasfj
Copy link
Contributor Author

jonasfj commented Oct 4, 2015

Idealy, we should perhaps just have one message:

{
  command: 'join',
  documentId: '...',
  createIfNotExists: true || false,
  token: '...',
  userId: '...'
}

With a response:

{
  responseType: 'document',
  error: "" || null,
  version: 1,
  document: {documentId: '...', content: '...'},
  readOnly: true || false
}

So you call with command: join and tell if the document should be created, if it doesn't exist.
And you get a responseType: document, if you are allowed read/write access you get that, if you're only allowed read-only access, that is all you get.

Otherwise clients have to know if they are allowed to join a document readonly or read/write... And this complicates things, especially since there aren't any formal error codes to rely on.

We could add a property acceptReadOnly: true || false to the request, so clients can indicate that they aren't interested in joining readonly, even if that is the only access they can get.

@Jeffail
Copy link
Owner

Jeffail commented Oct 4, 2015

This seems reasonable. I'm marking this as a bug since confusing APIs aren't an intended feature! The internal workings of leaps have changed significantly since the client API was first slapped together so it might be worth completely reworking them, possibly with respect to some of the other issues you've raised (like user IDs vs auth tokens etc).

@Jeffail Jeffail added the bug label Oct 4, 2015
@Jeffail
Copy link
Owner

Jeffail commented Oct 4, 2015

This should probably be tackled after #8 is resolved.

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

No branches or pull requests

2 participants