Skip to content

Fix #258: improve expose() algorithm #262

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

Merged
merged 2 commits into from
Sep 14, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1696,7 +1696,7 @@ <h2>ConsumedThing Examples</h2>
} catch (e) {
console.log("TD fetch error: " + e.message);
};

try {
// subscribe to property change for “temperature”
await thing.observeProperty("temperature", async (data) => {
Expand All @@ -1722,13 +1722,13 @@ <h2>ConsumedThing Examples</h2>
} catch (e) {
console.log("Error starting measurement.");
}

setTimeout(async () => {
try {
const temperatureData = await thing.readProperty("temperature")
const temperature = await temperatureData.value();
console.log("Temperature: " + temperature);

await thing.unsubscribe("ready");
console.log("Unsubscribed from the ‘ready’ event.");
} catch (error) {
Expand Down Expand Up @@ -1813,10 +1813,10 @@ <h2>ConsumedThing Examples</h2>
// Example of streaming processing: counting json objects
let objectCounter = 0
const parser = new Parser() //User library for json streaming parsing (i.e. https://github.com/uhop/stream-json/wiki/Parser)

parser.on('data', data => data.name === 'startObject' && ++objectCounter);
parser.on('end', () => console.log(`Found ${objectCounter} objects.`));

const response = await thing.readProperty(“eventHistory”)
await response.data.pipeTo(parser);

Expand Down Expand Up @@ -2874,7 +2874,13 @@ <h3>The <dfn>EventSubscriptionHandler</dfn> callback</h3>
<li>
Set up the <a>WoT Interactions</a> based on introspecting ||td||
as explained in [[!WOT-TD]] and [[!WOT-PROTOCOL-BINDINGS]].
Make a request to the underlying platform to initialize the <a>Protocol Bindings</a> and then start serving external requests for <a>WoT Interactions</a> (read, write and observe <a>Properties</a>, invoke <a>Action</a>s and manage <a>Event</a> subscriptions), based on the <a>Protocol Bindings</a>.
Make a request to the underlying platform to initialize the
<a>Protocol Bindings</a> and then start serving external requests
for <a>WoT Interactions</a> (read, write and observe <a>Properties</a>,
invoke <a>Action</a>s and manage <a>Event</a> subscriptions),
based on the <a>Protocol Bindings</a>.
Implementations MAY reject this step for any reason (e.g. if they
want to enforce further checks and constraints on interaction forms).
</li>
<li>
If there was an error during the request, reject |promise| with an {{Error}} object |error| with |error|'s |message| set to the error code seen by the <a>Protocol Bindings</a> and abort these steps.
Expand Down