-
Notifications
You must be signed in to change notification settings - Fork 28
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
Allow only one subscription per affordance #356
Conversation
@@ -1213,6 +1213,16 @@ <h4>Internal slots for ConsumedThing</h4> | |||
<td>`null`</td> | |||
<td>The <a>Thing Description</a> of the {{ConsumedThing}}.</td> | |||
</tr> | |||
<tr> | |||
<td><dfn>[[\activeSubscriptions]]</dfn></td> | |||
<td>`{}`</td> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was a good idea to have an internal slot as a set, as it is usable with all policies (replace existing, reject if existing, add, ...).
index.html
Outdated
@@ -1739,8 +1764,16 @@ <h3>The <dfn>subscribeEvent()</dfn> method</h3> | |||
Takes as arguments |eventName:string|, |listener:WoTListener| and | |||
optionally |onerror:ErrorListener| and |options:InteractionOptions|. | |||
It returns a {{Promise}} to signal success or failure. | |||
<p class="ednote"> | |||
This algorithm allow for only one active {{Subscription}} per <a>Event</a>. If a new |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we repeat this every time, or just say once for the whole API?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. I think another good place to state this is in the Subscription
section but I don't know if we want to keep this simple to possibly change it in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can also omit the ednote, since the algorithm is clear enough.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo?: this algorithm allowS ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work, thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am wondering why this PR includes changes to
typescript/thing-description/schema/td-json-schema-validation.json
and
typescript/thing-description/thing-description.d.ts
The changes should be already there... sync with master ?
fix 358
Cleaned up commit history and added a fix for #358. |
<tr> | ||
<td><dfn>[[\activeObservations]]</dfn></td> | ||
<td>`{}`</td> | ||
<td>A {{Set}} containing the names of active {{Subscription}}'s for an <a>Property</a></td> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess it should read
a set of active Observations but then internal linking is no longer working.... maybe we can refer to it by id
index.html
Outdated
@@ -1677,8 +1687,16 @@ <h3>The <dfn>observeProperty()</dfn> method</h3> | |||
Takes as arguments |propertyName:string|, |listener:InteractionListener| and | |||
optionally |onerror:ErrorListener| and |options:InteractionOptions|. | |||
It returns a {{Promise}} that resolves on success and rejects on failure. | |||
<p class="ednote"> | |||
This algorithm allow for only one active {{Subscription}} per <a>Property</a>. If a new |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo?: this algorithm allowS ...
Scripting Call 2021-12-13 |
@danielpeintner it should be ready to go :) |
This PR adds an additional step to
observeProperty
andsubscribeEvent
algorithms of theConsumeThing
. It forces the runtime implementation to check whether the affordance has already an active Subscription, and if it is the case the runtime must throw aNotAllowedError
. This should make clear to implementers that it is not possible to subscribe multime times to the same affordance, but I also added an editor note to make it cristal clear.The PR is currently in draft mode cause I wanted to use Set as type of the list of active Subscriptions/Observations but ECMA specification is not included among our
xref
and it conflicts withweb-platform
.Note: It covers the points raised in #346.
Preview | Diff