diff --git a/index.html b/index.html
index 0dcf450e..36eed4eb 100644
--- a/index.html
+++ b/index.html
@@ -51,7 +51,7 @@
]
},
],
- xref: ["web-platform", "streams", "wot-architecture", "wot-thing-description", "wot-binding-templates", "html", "infra"],
+ xref: ["web-platform", "streams", "wot-architecture", "wot-thing-description", "wot-binding-templates", "html", "infra", "ecmascript"],
localBiblio: {
"WOT-ARCHITECTURE" : {
href:"https://www.w3.org/TR/2020/WD-wot-architecture11-20201124/",
@@ -460,7 +460,7 @@
-->
-
+
The ThingDescription type
typedef object ThingDescription;
@@ -525,7 +525,7 @@ The ThingDescription type
-
+
The WOT namespace
Defines the WoT API object as a singleton and contains the API
@@ -719,7 +719,7 @@
Validating an ExposedThingInit
- Handling interaction data
+ Handling interaction data
As specified in the [[[WOT-TD]]] specification, WoT interactions extend DataSchema
and include a number of possible Forms, out of which one is selected
@@ -1222,7 +1222,7 @@
The InteractionOutput interface
-
+
The ConsumedThing interface
Represents a client API to operate a Thing. Belongs to the
@@ -1292,7 +1292,7 @@
The ConsumedThing interface
Meanwhile, use the writeMultipleProperties()
method instead.
- Internal slots for ConsumedThing
+ Internal slots for {{ConsumedThing}}
A {{ConsumedThing}} object has the following internal slots:
@@ -1310,6 +1310,16 @@ Internal slots for ConsumedThing
`null` |
The Thing Description of the {{ConsumedThing}}. |
+
+ [[\activeSubscriptions]] |
+ `{}` |
+ A {{Set}} containing the names of active {{Subscription}}'s for an Event |
+
+
+ [[\activeObservations]] |
+ `{}` |
+ A {{Set}} containing the names of active {{Subscription}}'s for an Property |
+
@@ -1677,8 +1687,16 @@ The observeProperty() method
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.
+
+ This algorithm allows for only one active {{Subscription}} per Property. If a new
+ {{Subscription}} is made while an existing {{Subscription}} is active the runtime
+ will throw an {{NotAllowedError}}.
+
The method MUST run the following steps:
+ -
+ Let |thing| be the reference of this {{ConsumedThing}} object.
+
-
Return a {{Promise}} |promise:Promise| and execute the next steps [=in parallel=].
@@ -1693,6 +1711,10 @@ The observeProperty() method
If |onerror| is not `null` and is not a {{Function}}, reject |promise|
with a {{TypeError}} and abort these steps.
+ -
+ if |thing| [[\activeObservations]] contains |propertyName|, reject |promise| with
+ a {{NotAllowedError}} and abort these steps.
+
-
Let |subscription| be a new {{Subscription}} object with its internal slots
set as follows:
@@ -1707,6 +1729,9 @@
The observeProperty() method
Let |subscription|'s [[\interaction]] be the value of [[\td]]'s
|properties|'s |propertyName|.
+ -
+ Let |subscription|'s [[\thing]] be the value of |thing|.
+
-
Let |subscription|'s [[\form]] be the Form associated with
|formIndex| in [[\interaction]]'s |forms| array if |option|'s
@@ -1734,7 +1759,7 @@
The observeProperty() method
the Protocol Bindings and abort these steps.
-
- Otherwise resolve |promise|.
+ Otherwise add |propertyName| to |thing|'s' [[\activeObservations]] set and resolve |promise|.
-
Whenever the underlying platform detects a notification for this
@@ -1836,8 +1861,16 @@
The subscribeEvent() method
Takes as arguments |eventName:string|, |listener:WoTListener| and
optionally |onerror:ErrorListener| and |options:InteractionOptions|.
It returns a {{Promise}} to signal success or failure.
+
+ This algorithm allows for only one active {{Subscription}} per Event. If a new
+ {{Subscription}} is made while an existing {{Subscription}} is active the runtime
+ will throw an {{NotAllowedError}}.
+
The method MUST run the following steps:
+ -
+ Let |thing| be the reference of this {{ConsumedThing}} object.
+
-
Return a {{Promise}} |promise:Promise| and execute the next steps [=in parallel=].
@@ -1852,6 +1885,10 @@ The subscribeEvent() method
If |onerror| is not `null` and is not a {{Function}}, reject |promise|
with a {{TypeError}} and abort these steps.
+ -
+ if |thing| [[\activeSubscriptions]] contains |eventName|, reject |promise| with
+ a {{NotAllowedError}} and abort these steps.
+
-
Let |subscription| be a new {{Subscription}} object with its internal slots
set as follows:
@@ -1866,6 +1903,9 @@
The subscribeEvent() method
Let |subscription|'s [[\interaction]] be the value of [[\td]]'s
|events|'s |eventName|.
+ -
+ Let |subscription|'s [[\thing]] be the value of |thing|.
+
-
Let |subscription|'s [[\form]] be the Form associated with
|formIndex| in [[\interaction]]'s |forms| array if |option|'s
@@ -1894,7 +1934,7 @@
The subscribeEvent() method
the Protocol Bindings and abort these steps.
-
- Otherwise resolve |promise|.
+ Otherwise add |eventName| to |thing|'s [[\activeSubscriptions]] set and resolve |promise|.
-
Whenever the underlying platform detects a notification for this
@@ -2053,6 +2093,11 @@
The Subscription interface
`null` |
The Form associated with the subscription. |
+
+ [[\thing]] |
+ `null` |
+ The ConsumedThing associated with the subscription. |
+
@@ -2103,8 +2148,21 @@ The stop() method
the Protocol Bindings and abort these steps.
-
- Otherwise set active to
- `false` and resolve |promise|.
+ Otherwise:
+
+ -
+ set active to `false`.
+
+ -
+ if [[\type]] is `"event"`, remove [[\name]] from [[\thing]]'s [[\activeSubscriptions]] .
+
+ -
+ if [[\type]] is `"property"`, remove [[\name]] from [[\thing]]'s [[\activeObservations]] .
+
+ -
+ resolve |promise|.
+
+
-
If the underlying platform receives further notifications for this
@@ -2309,7 +2367,7 @@
ConsumedThing Examples
-
+
The ExposedThing interface
The {{ExposedThing}} interface is the server API to operate the Thing that allows defining request handlers, Property, Action, and Event interactions.
@@ -3609,7 +3667,7 @@
ExposedThing Examples
-
+
The ThingDiscovery interface
Discovery is a distributed application that requires provisioning and support from participating network nodes (clients, servers, directory services). This API models the client side of typical discovery schemes supported by various IoT deployments.