Skip to content

onObserve() cannot be used for both Property change notifications and Event notifications -- and should be removed alltogether #73

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

Closed
mkovatsc opened this issue Oct 25, 2017 · 5 comments

Comments

@mkovatsc
Copy link
Contributor

Property change (or change-of-value/CoV) notifications are fundamentally different from Events that have an identity on their own (e.g., such Events must not be lost while CoV notifications can).

onObserve() should be fully ignored by scripts and completely handled by the WoT Runtime. A possible onNewObserver() shall be kept in implementtion space, i.e., outside standardization for now.

Similarly, there is no need to standardize an onSubscribe() because the user shall not be required to manage this; the WoT Runtime needs to. The user/script only emits Events.

@zolkis
Copy link
Contributor

zolkis commented Oct 25, 2017

onObserve() is an application defined handler for observe requests, not to be confused with event handling. Please read the text.
Scripts do need to define a handler for requests in ExposedThing, including observe requests for everything that emits an event on the ConsumerThing counterpart:

  • when a property value has changed
  • when an action was invoked
  • when a TD is changed.

Do you want to drop this feature?

@mkovatsc
Copy link
Contributor Author

The text for onObserve() says

request.name defines the name of the Property or Action or event to be observed.

Overall, the issue already starts in ConsumedThing.observe() where it is used also for both, CoV and stand-alone Events -- not sure what observing an Action means. While we can use the concept of Observables for both, the theory behind observing CoV and subscribing to Events is different as indicated above.

I would like to focus first on what is fundamentally required for scripting WoT mashups (cf. PHP vs Jetty). Lets open a bucket for these "maybe nice to have calls" and remember them. Once we have a minimal viable Scripting API, we can still bloat it up.

@mkovatsc
Copy link
Contributor Author

Digging in further shows that Events in the Scripting API are not aligned with Events in the TD model.

As of now, the TD Interaction Model foresees

  • Observable Properties, which can push change-of-value notifications (which only need eventual consistency, so intermediate notifications may be lost or even filtered to reduce the load)
  • Events, which define sources of individual event instances. Clients can subscribe to sources and each event instance must be transferred from the source to the client.

This difference should also be reflected in the Scripting API with different calls. Both may make use of the Observer programming pattern.

@zolkis
Copy link
Contributor

zolkis commented Oct 25, 2017

That is right, this is work to be done. We track that in issue #68.

@zolkis
Copy link
Contributor

zolkis commented Feb 14, 2018

Addressed by #86.

@zolkis zolkis closed this as completed Feb 14, 2018
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

2 participants