Example Sequences of interaction patterns (for discussion in Prague) - - PowerPoint PPT Presentation

example sequences of interaction patterns for discussion
SMART_READER_LITE
LIVE PREVIEW

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,


slide-1
SLIDE 1

Example Sequences of interaction patterns (for discussion in Prague)

2018/3/27 Panasonic Toru Kawaguchi (with Kazuo Kajimoto)

slide-2
SLIDE 2

Motivation

  • For interaction patterns (Property, Action and

Event), we have rough consensus on which to use for what, how to use them, and so on.

  • But there is no clear description of end‐to‐end

sequence for each interaction pattern, so it is not easy to identify

  • what is specified and what is not within spec
  • consistency between TD, Scripting and Binding
  • To make clear such aspect, this is a strawman to

walk through the end‐to‐end sequence with diagrams.

2018/3/27 Panasonic Corporation 1

slide-3
SLIDE 3

Server (Thing) Client

  • 1. Property

1.1 readProperty (binding = HTTP)

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

slide-4
SLIDE 4

Server (Thing) Client

  • 1. Property

1.2 writeProperty (binding = HTTP)

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

slide-5
SLIDE 5

Server (Thing) Client

  • 1. Property

1.3a observeProperty (binding = HTTP Long Polling)

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

slide-6
SLIDE 6

Server (Thing) Client

  • 1. Property

1.3b observeProperty (binding = Simple WebSocket)

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

slide-7
SLIDE 7

Server (Thing) Client

  • 2. Action (binding = HTTP)

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)

  • perates corresponding

device and waits completion sends back HTTP POST Response (payload: outputSchema data) calls back Promise resolving to

  • utputSchema data

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?

slide-8
SLIDE 8

Server (Thing) Client

  • 3a. Event

(binding = HTTP Long Polling)

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

slide-9
SLIDE 9

Server (Thing) Client

  • 3b. Event

(binding = Simple WebSocket)

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)

slide-10
SLIDE 10

Further things to consider

  • Textual definition and explanation of interaction

patterns at one place (e.g. architecture document), , prior to this illustration

  • What are the Property, Action, Event is
  • How the Property, Action, Event can be used

(https://github.com/w3c/wot‐ architecture/issues/49#issuecomment‐375266465)

  • How to model more complicated patterns?
  • Asynchronous Action with monitor and cancel features.
  • Do we need examples for other protocol bindings?
  • CoAP, MQTT, …
  • Event with late binding (prior Panasonic proposal)

2018/3/27 Panasonic Corporation 9