W3C home > Mailing lists > Public > public-wot-ig@w3.org > November 2016

Re: Regular Web of Things call on scripting API

From: Dave Raggett <dsr@w3.org>
Date: Tue, 1 Nov 2016 14:31:42 +0000
Cc: "Hund, Johannes" <johannes.hund@siemens.com>, "public-wot-ig@w3.org" <public-wot-ig@w3.org>
Message-Id: <059AAA21-89E1-4277-8AA9-3C6B7C409C48@w3.org>
To: Benjamin Francis <bfrancis@mozilla.com>
Hi Ben,

How would your proposal decouple application scripts from the platform’s choice of protocols, given that REST and HTTP isn’t always appropriate?

In my own NodeJS based project, I provided an API for servers to expose a new thing, and another for clients to create a local thing as a proxy for a thing hosted on a remote server. For the first case I have:

     wot.thing(name, model, implementation)

where name is a string, model is a JSON object with declarations for properties, actions and events, and the implementation is a JSON object with named functions start(thing) and stop(thing). The server exposes the new thing, appending the thing’s name to the server’s configured base URI. The app provided start method is responsible for initialising the values of the properties and for providing implementations for the actions. For a sensor app, the implementation defines a means to update properties from the sensors, e.g. using a timer to read the sensor every second.

The API for registering a proxy for a remote thing is a method that is passed the URI for the thing’s description, and call backs for success and failure. The success call back is passed the newly created object for the thing. A related case is where a gateway behind a firewall wants to publish a thing it hosts on a public cloud server.

The Current Practises document covers the experiments used in the plugfests, but we lack a formal use cases and requirements study for scripting APIs, and I believe that that would help with the discussion over design choices.


> On 1 Nov 2016, at 11:49, Benjamin Francis <bfrancis@mozilla.com> wrote:
> 
> Ben from Mozilla is still wondering whether we should standardize scripting API.
> 
> To explain, I think the use cases of both the "Scripting API" and the "WoT Interface" could be fulfilled by a single WoT REST API.
> 
> For example, rather than a function call like:
> WoT.createThingFromDescription({"name": "My Temperature Sensor", ...});
> 
> Registering a new Thing should be an HTTP POST request with a Thing Description in the body, e.g.:
> POST http://mythingserver.com/things <http://mythingserver.com/things>
> {
>   "name: "My Temperature Sensor",
>   ...
> }
> There's nothing to stop someone from creating a helper library to call that REST API from a particular programming language, but I see no need to standardise a language-agnostic scripting API for this purpose. In fact doing so could be problematic (not all languages natively support the concept of Promises you're using for example).
> 
> As I understand it this is how Google Weave and EVRYTHNG APIs work, and it's how other platforms work too (sometimes with a REST API being called behind a provided language-specific software library). It's also how I would expect Mozilla's implementation to work.
> 
> Ben
> 
> On 31 October 2016 at 13:18, Hund, Johannes <johannes.hund@siemens.com <mailto:johannes.hund@siemens.com>> wrote:
> Dear group,
> 
>  
> 
> We just had another call on the scripting API track.
> 
>  
> 
> See minutes: http://www.w3.org/2016/10/31-wot-minutes.html <http://www.w3.org/2016/10/31-wot-minutes.html>
> Thanks to Yingying for scribing.
> 
>  
> 
> These calls will be done regularly, we plan for weekly calls at first.
> 
> As reference, we used 13:00 CET, which leads to some daylight savings trouble.
> 
>  
> 
> Next call time on and after Monday, November 7, 2016
> 
>  
> 
> - 4am US Pacific
> 
> - 7am US Eastern
> 
> - Noon UK
> 
> - 1pm Central Europe
> 
> - 8pm China
> 
> - 9pm Korea/Japan
> 
>  
> 
> Meeting link: https://mit.webex.com/mit/j.php?MTID=m2a1901e571dec21225ed85d7d5b3585f <https://mit.webex.com/mit/j.php?MTID=m2a1901e571dec21225ed85d7d5b3585f>
>  
> 
> Irc used is #wot on irc.w3.org <http://irc.w3.org/>
>  
> 
> We mainly focus these calls on technical work, and as sync points for the discussion on Github: https://github.com/w3c/wot/labels/Scripting <https://github.com/w3c/wot/labels/Scripting>
>  
> 
> Issues, proposals and other agenda points to be discussed are collected on the beginning of the call (agenda-bashing).
> 
>  
> 
> Please feel greatly invited to join if you are interested in contributing to or implementing scripting topics for the Web of Things.
> 
>  
> 
> Best regards,
> 
> Johannes
> 
> 

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




Received on Tuesday, 1 November 2016 14:31:59 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 19:27:08 UTC