[TF-AP] Explicit polling vs leaving it to the server & metadata to optimise

Hi Johannes,

Further to our conversation during the WoT IG TF-AP breakout, I realised that I had forgotten an important point.

I believe that you want to support direct polling by applications for thing properties, e.g. for a property named “foo”, you could used something like:

      thing.requestData(“foo").then(function (data) { /* do something */ } );

Whereas, I suggest allowing the server to use the metadata to select the best communication pattern and protocol in order to simplify the job of the app developer, who can then use code like

     /* do something with */  thing.foo

However, you could still achieve the explicit polling behaviour by defining “foo” as an action instead of a property, e.g. allowing you to write:

      thing.foo().then(function (data) { /* do something */ } );

since actions are passed up the proxy chain towards the thing.

Note that the API for creating a proxy is asynchronous, as it could take a while to complete, for instance where the server has to create proxies for things which are properties of the requested thing. For JavaScript it would make sense to apply promises to this.

The proxies could be chained to form a tree rooted in a thing. If the proxies use the pull communication pattern, the proxies could cache the property values just as for web resources accessed via an HTTP proxy chain. The push communication pattern, by contrast propagates changes out from the root to the leaves.

p.s. my presentation is on the wiki at: https://www.w3.org/WoT/IG/wiki/images/7/7d/Wot-framework.pdf 

Best regards,
—
   Dave Raggett <dsr@w3.org <mailto:dsr@w3.org>>

Received on Friday, 30 October 2015 05:16:16 UTC