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

Clarify sendCommand method's usage protocol #28

Open
YegorUdovchenko opened this issue Oct 1, 2018 · 0 comments
Open

Clarify sendCommand method's usage protocol #28

YegorUdovchenko opened this issue Oct 1, 2018 · 0 comments

Comments

@YegorUdovchenko
Copy link
Collaborator

YegorUdovchenko commented Oct 1, 2018

The current description of the sendCommand method does not expose all the nuances of its use.

successCallback (better rename to acknowledged)

  1. When it is called, does it guaranty that the command is acknowledged with a server and its handling will lead to the expected model change?
  2. When it is called, what other callbacks invocations can occur after?
  3. If any other callbacks are called after it, does it mean that the model won't be modified?

errorCallback

  1. When it is called, how to process the passed error object, and what does each of its types means in the context of sendCommand invocation? (see Reconsider the approach to the formation of errors given by the spine-web-client #26 for error classification proposal)
  2. If successCallback is called after it, can it mean that the command will be handled despite the error?

rejectionCallback

  1. Does its call guaranty, that all other callbacks won't be called?
  2. Can it be called after successCallback or errorCallback?

The above clarifications are necessary to implement the scenario of optimistic updating of data on the client. For example, the client sends the command to update some model entity, the specified entity on the client side is optimistically updated with the expected value. Then the client starts to wait for the corresponding entity updates from the subscription (subscribeToEntities method).

  1. When the updated data can be displayed? Can it be displayed after sendCommand execution immediately or should it wait for the successCallback invocation? (BTW, waiting for the successCallback can result in the UI holdup in case of a slow internet connection).
  2. When the errorCallback is called before the updated state received, should the previous entity state be restored? Should it be restored if the error is connection-kind?
  3. When it is reasonable to show the message of command sending failure?
  4. If the updated state is received from the subscription, should we ignore any further errorCallback invocations from the sendCommand?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant