You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: rationale.md
+6-4Lines changed: 6 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -15,19 +15,21 @@ As discussed in [issue 3](https://github.com/w3c/wot-scripting-api/issues/3), an
15
15
Resolutions:
16
16
- The browser implementations of the WoT Scripting API uses a namespace object `wot` in the browser.
17
17
- Non-browser implementations that use various runtimes may use either a namespace object `wot`, or an API object provided by the `require()` or `import()` or similar mechanisms.
18
-
- The `ConsumedThing` and `ExposedThing` objects are created by factory methods.
19
-
18
+
- The `ConsumedThing` and `ExposedThing` objects are expected to be created by factory methods, though constructors are defined.
19
+
- Interaction data can be retrieved with an attempted conversion by implementation as convenience interface for most JavaScript types, or as streams the applications can interpret.
20
+
- Errors during protocol operations are exposed to applications.
20
21
21
22
## Discovery API
22
23
23
-
Based on [WoT Current Practices](https://w3c.github.io/wot/current-practices/wot-practices.html#td-discovery), there are different discovery types: local (to the hardware), proximity based (such as BLE or NFC), registry (directory) based, and broadcast/multicast based. The discovery type is specific to the underlying protocol bindings.
24
+
Represents the second stage of discovery in the [2-stage discovery process](https://github.com/w3c/wot-discovery/blob/master/proposals/directory.md), i.e. the
25
+
operational stage when discovery is configured and discovery queries may be served.
24
26
25
27
The discovery results may be filtered either at the source or at reception, by constraints made on the Thing Description.
26
28
27
29
Based on [issue 16](https://github.com/w3c/wot-scripting-api/issues/16) there is a need to be able to tell the WoT Runtime to stop discovery (or in the case of open ended requests, suppress further discovery results). Therefore returning `Promise` was not an option any more, since cancellable `Promise`s were [dropped](https://github.com/tc39/proposal-cancelable-promises).
28
30
29
31
Resolutions:
30
-
- Use [Observables](https://github.com/tc39/proposal-observable) for controlling the discovery process (subscribe, unsubscribe).
32
+
- Use [Observables](https://github.com/tc39/proposal-observable)or similar pattern for controlling the discovery process (subscribe, unsubscribe, handle notifications).
31
33
- Use a single filter definition that also contains a property for discovery type, defaulting to `"any"`. It is simpler and more intuitive to use than having a separate parameter for discovery type. Some of the discovery types, such as registry/directory based discovery also require another parameter for the address of the directory. This can be provided as a required property in the discovery filter, described in the discovery algorithm.
0 commit comments