Example Sequences of interaction patterns (for discussion in Prague)
2018/3/27 Panasonic Toru Kawaguchi (with Kazuo Kajimoto)
Example Sequences of interaction patterns (for discussion in Prague) - - PowerPoint PPT Presentation
Example Sequences of interaction patterns (for discussion in Prague) 2018/3/27 Panasonic Toru Kawaguchi (with Kazuo Kajimoto) Motivation For interaction patterns (Property, Action and Event), we have rough consensus on which to use for what,
2018/3/27 Panasonic Toru Kawaguchi (with Kazuo Kajimoto)
2018/3/27 Panasonic Corporation 1
Server (Thing) Client
calls thing.readProperty()
Scripting API WoT Server Application Device
2018/3/27 Panasonic Corporation 2
returns Promise sends HTTP GET Request to href of form retrieves Property value from corresponding device sends back HTTP GET Response (payload: schema data) calls back Promise resolving to schema data
Server (Thing) Client
calls thing.writeProperty()
Scripting API WoT Server Application Device
2018/3/27 Panasonic Corporation 3
returns Promise sends HTTP PUT Request to href of form (payload: schema data) sets Property value to corresponding device sends back HTTP PUT Response calls back Promise resolving to void
Server (Thing) Client
calls thing .onPropertyChange() .subscribe(Observer)
Scripting API WoT Server Application Device
2018/3/27 Panasonic Corporation 4
returns Subscription sends HTTP GET Request to href of form with rel=observeProperty waits until corresponding device detects change sends back HTTP GET Response (payload: schema data) calls back Observer.next() with schema data
detect
sends HTTP GET Request to href of form with rel=observeProperty again returns void calls Subscription .unsubscribe() cancels ongoing HTTP GET Request to href of form
Server (Thing) Client
calls thing .onPropertyChange() .subscribe(Observer)
Scripting API WoT Server Application Device
2018/3/27 Panasonic Corporation 5
returns Subscription connects WebSocket to href of form with rel=observeProperty waits until corresponding device detects change sends schema data to WoT Client Lib through WebSocekt connection calls back Observer.next() with schema data
detect
returns void calls Subscription .unsubscribe() disconnects WebSocket connection
Server (Thing) Client
Calls thing.invokeAction()
Scripting API WoT Server Application Device
2018/3/27 Panasonic Corporation 6
returns Promise sends HTTP POST Request to href of form (payload: inputSchema data)
device and waits completion sends back HTTP POST Response (payload: outputSchema data) calls back Promise resolving to
finish
Note: ‐ Considering that consumedThing only have invokeAction() method currently, assumption here is that POST method is synchronous, so it returns after some time when the device completed the action. ‐ Question: do we need to consider adding “cancelAction()” in this case?
Server (Thing) Client
calls thing. onEvent() .subscribe(Observer)
Scripting API WoT Server Application Device
2018/3/27 Panasonic Corporation 7
returns Subscription sends HTTP GET Request to href of form with rel=subscribeEvent waits until corresponding device detects change sends back HTTP GET Response (payload: schema data) calls back Observer.next() with schema data
detect
sends HTTP GET Request to href of form with rel=observeProperty again returns void calls Subscription .unsubscribe() cancels ongoing HTTP GET Request to href of form
Server (Thing) Client
Scripting API WoT Server Application Device
2018/3/27 Panasonic Corporation 8
returns Subscription connects WebSocket to href of form with rel=subscribeEvent waits until corresponding device detects change sends schema data to WoT Client Lib through WebSocekt connection calls back Observer.next() with schema data
detect
returns void calls Subscription .unsubscribe() disconnects WebSocket connection calls thing. onEvent() .subscribe(Observer)
patterns at one place (e.g. architecture document), , prior to this illustration
(https://github.com/w3c/wot‐ architecture/issues/49#issuecomment‐375266465)
2018/3/27 Panasonic Corporation 9