Copyright © 2017-2023 World Wide Web Consortium . W3C ® liability , trademark and permissive document license rules apply.
W3C Web of Things enables applications to interact with and orchestrate connected Things at the Web scale. The standardized abstract interaction model exposed by the WoT Thing Description enables applications to scale and evolve independently of the individual Things.
Many network-level protocols, standards and platforms for connected Things have already been developed, and have millions of devices deployed in the field today. These standards are converging on a common set of transport protocols and transfer layers, but each has peculiar content formats, payload schemas, and data types.
Despite using unique formats and data models, the high-level interactions exposed by most connected things can be modeled using the Property, Action, and Event interaction affordances of the WoT Thing Description.
Binding Templates enable a Thing Description to be adapted to a specific protocol, data payload formats or platforms that combine both in specific ways. This is done through additional descriptive vocabularies, Thing Models and examples that aim to guide the implementors of Things and Consumers alike.
This core specification document acts as a base and explains how other binding templates should be designed. Concrete binding templates are then provided in their respective documents, referred to as subspecifications, that are linked to from this document.
This section describes the status of this document at the time of its publication. A list of current W3C publications and the latest revision of this technical report can be found in the W3C technical reports index at https://www.w3.org/TR/.
Please contribute to this draft using the GitHub Issue feature of the WoT Binding Templates repository. For feedback on security and privacy considerations, please use the WoT Security and Privacy Issues, as they are cross-cutting over all our documents.
This document was published by the Web of Things Working Group as an Editor's Draft.
Publication as an Editor's Draft does not imply endorsement by W3C and its Members.
This is a draft document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate to cite this document as other than work in progress.
This document was produced by a group operating under the W3C Patent Policy . W3C maintains a public list of any patent disclosures made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains Essential Claim(s) must disclose the information in accordance with section 6 of the W3C Patent Policy .
This document is governed by the 2 November 2021 W3C Process Document .
Binding Templates consist of multiple specifications, referred to as a subspecification in this document, that enable an application client (a WoT Consumer) to interact, using WoT Thing Description[ WOT-THING-DESCRIPTION ] (TD), with Things that exhibit diverse protocols, payload formats and their usage. These subspecifications are categorized into three:
Each
Binding
Template
Subspecification
is
an
independent
document
that
has
a
separate
list
of
authors
and
publication
date.
This
document,
called
the
Binding
Template
Core
Specification
,
explains
the
binding
mechanism
by
giving
requirements
per
respective
binding
category
and
links
to
the
respective
subspecification.
These
can
be
found
in
sections
4.1
Protocol
Binding
Templates
,
4.2
4.2.1
Introduction
to
Payload
Binding
Templates
and
4.3
Platform
Binding
Templates
Each Protocol and Payload Binding Template is specified in a way that they stay independent from each other. This means that each document can be read independently from each other and can also develop independently. However, Platform Binding Templates are dependent on the Protocol and Payload Binding Templates, since a given platform uses different protocols and payload formats that need to be specified first in their respective binding templates and referred to within a Platform Binding Template.
As well as sections marked as non-normative, all authoring guidelines, diagrams, examples, and notes in this specification are non-normative. Everything else in this specification is normative.
The key words MUST and SHOULD in this document are to be interpreted as described in BCP 14 [ RFC2119 ] [ RFC8174 ] when, and only when, they appear in all capitals, as shown here.
This section is non-normative.
The fundamental WoT terminology such as Thing , Consumer , Thing Description ( TD ), Interaction Model , Interaction Affordance , Property , Action , Event , Protocol Binding , Binding Template , Servient , Vocabulary , WoT Interface , WoT Runtime , etc. is defined in Section 3 of the WoT Architecture specification [ WOT-ARCHITECTURE ].
In addition, this specification introduces the following definitions:
This section describes the mechanisms of binding templates for protocols, payload formats and platforms.
[
WOT-THING-DESCRIPTION
]
defines
abstract
operations
such
as
readproperty
,
invokeaction
and
subscribeevent
that
describe
the
intended
semantics
of
performing
the
operation
described
by
the
form
in
a
Thing
Description
.
In
order
for
the
operations
to
be
performed
on
the
affordance,
a
binding
of
the
operation
to
the
protocol
needs
to
happen.
In
other
words,
the
form
needs
to
contain
all
the
information
for
a
Consumer
to,
for
example
read
a
property,
with
the
protocol
in
the
form.
Most
protocols
have
a
relatively
small
set
of
methods
that
define
the
message
type,
the
semantic
intention
of
the
message.
REST
and
PubSub
architecture
patterns
result
in
different
protocols
with
different
methods.
Each
target
protocol
may
specify
different
method
names
for
similar
operations,
and
there
may
be
semantic
differences
between
similar
method
names
of
different
protocols.
Additionally,
Things
may
use
different
methods
for
performing
a
particular
WoT
operation.
For
example,
an
HTTP
POST
request
may
be
used
for
a
writeproperty
operation
in
one
Thing,
while
HTTP
PUT
may
be
used
in
another.
For
these
reasons,
Thing
Descriptions
require
the
ability
to
specify
which
method
to
use
per
operation.
Common
methods
found
in
REST
and
PubSub
protocols
are
GET,
PUT,
POST,
DELETE,
PUBLISH,
and
SUBSCRIBE.
Binding
Templates
describe
how
these
existing
methods
and
associated
vocabularies
can
be
used
in
a
Thing
Description
to
bind
to
the
WoT
operations.
This
is
done
by
defining
the
URI
scheme
of
the
protocol
and
mapping
the
protocol
methods
to
the
abstract
WoT
operations
such
as
readproperty
,
invokeaction
and
subscribeevent
.
In
some
cases,
additional
instructions
are
provided
to
explain
how
the
vocabulary
terms
should
be
used
in
different
cases
of
protocol
usage.
The
examples
below
shows
the
binding
of
the
readproperty
operation
for
the
HTTP
and
Modbus
protocols.
|
Example
1
:
Binding
example
of
a
readproperty
operation
to
HTTP
|
Example
2
:
Binding
example
of
an
readproperty
operation
to
Modbus
|
In
some
cases,
header
options
or
other
parameters
of
the
protocols
need
to
be
included.
Given
that
these
are
highly
protocol
dependent,
please
refer
to
the
bindings
listed
in
4.1.1
4.1.2
Existing
Protocol
Binding
Templates
The table below summarizes the currently specified protocols in their respective Binding Template Subspecification .
| Abbreviation | Name | Link to Binding Template | Link to Ontology |
|---|---|---|---|
| HTTP | Hypertext Transfer Protocol | Binding Template | Ontology |
| CoAP | Constrained Application Protocol | Binding Template | Not available |
| MQTT | Message Queuing Telemetry Transport | Binding Template | Ontology |
| Modbus | Modbus | Binding Template | Ontology |
When creating a new protocol binding template subspecification , e.g. based on a new communication protocol, the proposed document should enable implementations of this binding in an interoperable way for Consumer and Producer implementations. More specifically, each Binding Template Subspecification MUST specify the following:
base
or
in
the
href
term
of
the
forms
container.
These
can
be
officially
registered
ones
at
IANA
[
iana-uri-schemes
]
(e.g.
"https://"
,
"coap://"
)
or
they
can
be
declared
in
the
protocol
subspecification
(e.g.
"mqtt://"
,
"modbus+tcp://"
).
How
the
full
URI
can
be
constructed
for
different
affordances
(or
resources)
MUST
be
specified
as
well.
@context
Usage
and
Ontology:
A
vocabulary
that
allows
adding
protocol
options
to
a
Thing
Description
forms
SHOULD
be
provided
to
allow
semantic
annotations
of
the
operations
with
protocol
specific
information.
The
prefix
and
IRI
to
be
used
in
the
@context
in
order
to
link
to
the
vocabulary
of
the
protocol
SHOULD
be
also
provided.
readproperty
,
invokeaction
,
etc.)
to
concrete
protocol
message
types
or
methods.
When
specifying
the
mapping,
the
mapping
SHOULD
be
bidirectional,
i.e.
it
should
be
clear
how
to
do
a
readproperty
operation
with
the
given
protocol
and
how
an
existing
implementation's
endpoints
can
be
mapped
to
a
WoT
operation
should
be
also
clear.
A template is also provided for new protocol binding template specifications at the GitHub Repository.
[
WOT-THING-DESCRIPTION
]
defines
two
mechanisms
to
describe
how
a
payload
of
protocols
a
message
over
any
protocol
can
be
described
in
TDs
using
two
mechanisms:
Media
Types:
Media
Types
look
like.
Firstly,
media
types
[
IANA-MEDIA-TYPES
]
describe
the
encoding
serialization
used
for
sending
and
receiving
the
data
with
a
protocol.
They
are
represented
with
within
the
contentType
in
the
Forms
of
a
TD,
which
is
mandatory
for
each
Interaction
Affordance.
In
some
cases
such
as
images,
videos
or
any
unstructured
data,
they
are
enough
Secondly,
it
defines
the
Data
Schema
concept
to
describe
the
payload.
Correct
indication
structure
of
Media
the
messages,
which
are
used
together
with
media
types.
The
combination
of
the
two
allows
any
message
to
be
described
in
a
TD,
allowing
correct
serialization
and
deserialization
of
the
messages
by
the
Thing
and
Consumers.
In the rest of this section at 4.2.1.1 Content Types and 4.2.1.2 Data Schemas , you can find examples of how payload bindings can look like. At 4.2.2 Existing Payload Binding Templates you can find the current payload binding templates and 4.2.3 Creating a new Payload Binding Template Subspecification explains how new payload binding templates can be created.
Content
type
includes
the
media
type
and
potential
parameters
for
the
media
type
and
it
enables
proper
processing
of
the
serialized
documents.
This
way,
the
documents
messages
can
be
exchanged
in
any
format
and
allow
the
upper
layers
of
an
application
to
adapt
to
different
formats.
In
some
cases
such
as
images,
videos
or
any
unstructured
data,
content
type
is
enough
to
describe
the
payload
but
in
cases
like
JSON
([
RFC8259
])
a
Data
Schema:
The
Schema
is
usually
provided,
like
explained
in
4.2.1.2
Data
Schemas
.
For
example,
a
number
payload
can
be
serialized
as
JSON
or
XML
and
be
indicated
in
the
contentType
of
the
forms
with
application/json
or
application/xml
,
respectively.
Further
parametrization
is
possible
via
the
plus
(
+
)
or
the
semicolon
(
;
)
notations.
In
the
example
below,
you
can
find
the
form
elements
with
content
types
for
JSON
and
plain
text
with
additional
parameters.
In
this
specific
case,
the
forms
describe
that
reading
this
property
with
http
or
coap
result
in
different
content
types.
For
structured
media
types,
a
Data
Schema
is
generally
provided
in
the
affordance
level
as
explained
in
4.2.1.2
Data
Schemas
and
in
the
Data
Schema
section
of
the
TD
specification
defines
the
.
However,
for
unstructured
data
such
as
images
and
videos,
a
Data
Schema
concept
to
describe
is
typically
not
available.
{ "forms":[
{
"href": "http://example.com/properties/temperature", "op": "readproperty", "contentType": "application/json"
},
{
"href": "coap://example.com/properties/temperature", "op": "readproperty", "contentType": "text/plain;charset=utf-8"
}]
}
Other content types can be also expressed in TDs. In the list below, examples of different content type variations can be found. These content types can replace the ones in Example 3 .
application/json
:
JSON
[
RFC8259
]
application/xml
:
XML
[
RFC5364
]
application/cbor
:
CBOR
[
RFC8949
]
text/csv
:
CSV
[
RFC4180
]
application/senml+json
:
SenML
Data
serialized
in
JSON
[
RFC8259
]
application/senml+xml
:
SenML
Data
serialized
as
XML
application/ocf+cbor
:
OCF
payload
serialized
in
CBOR
text/csv;charset=utf-8
:
CSV
encoded
in
UTF-8
[
RFC4180
]
image/jpeg
:
JPEG
image
video/mp4
:
MP4
Video
application/octet-stream
:
Generic
binary
stream
Data
Schema,
as
explained
in
[
WOT-THING-DESCRIPTION
],
describes
the
structure
of
the
data
payloads.
messages,
which
are
used
together
with
media
types.
Even
though
it
is
largely
inspired
by
JSON
Schema
[
json-schema
],
it
can
be
used
for
describing
other
payload
types
such
as
[
XML
],
string-encoded
images,
bit
representations
of
integers,
etc.
Data
Schema
SHOULD
be
used
in
addition
to
the
media
types.
Depending on the case, the structure of the messages can be anything from a simple number to arrays or objects with multiple levels of nesting. Existing IoT Platforms and Standards have certain payload formats with variations on how the data is structured. As explained in [ WOT-THING-DESCRIPTION ], Data Schema can be used in a TD in one of the following places:
input
and
output
keywords
are
used
to
provide
two
different
schemas
when
data
is
exchanged
in
both
directions,
such
as
in
the
case
of
invoking
an
Action
Affordance
with
input
parameters
and
receiving
status
information.
data
,
dataResponse
,
subscription
and
cancellation
are
used
to
describe
the
payload
when
the
event
data
is
delivered
by
the
Exposed
Thing,
the
payload
to
reply
with
for
event
deliveries,
the
payload
needed
to
subscribe
to
the
event
and
the
payload
needed
to
cancel
receiving
event
data
from
the
Exposed
Thing,
respectively.
uriVariables
can
describe
the
data
that
needs
to
be
supplied
inside
the
request
URI
as
a
string.
Below is an example of a simple JSON object payload with the corresponding Data Schema. Examples from various IoT Platforms and Standards can be found in B. Examples of Payloads and Data Schemas from IoT Platforms and Standards .
Example
4
:
Simple
JSON
Object
Payload
|
Example
5
:
DataSchema
for
Simple
JSON
Object
Payload
|
| Abbreviation | Name | Media Type | Link |
|---|---|---|---|
| JSON | JavaScript Object Notation |
application/json
|
TODO |
| XML | eXtensible Markup Language |
application/xml
|
Link |
| text | text |
text/plain
|
TODO |
| Unstructured Data | Unstructured Data | various | TODO |
Each
payload
binding
template
subspecification
,
SHOULD
contain
the
respective
media
type.
Ideally
this
media
type
has
been
registered
at
the
IANA
registry
[
IANA-MEDIA-TYPES
]
with
a
corresponding
mime
type
(e.g.
application/json
).
If
it
is
not
registered,
the
binding
document
can
propose
a
mime
type.
Additionally,
how
that
media
type
is
represented
in
a
Data
Schema
SHOULD
be
demonstrated
with
examples.
In
all
cases,
the
following
information
SHOULD
be
provided:
There are already various IoT platforms on the market that allows exposing physical and virtual Things to the Internet. These platforms generally propose a certain API specification over a protocol and media type. Thus, they can be seen as a combination of the 4.1 Protocol Binding Templates and 4.2 Payload Binding Templates . Platform Binding subspecification s provide Thing Models and examples of TDs on how to integrate these platforms in to the W3C Web of Things.
The table below summarizes the currently specified platform binding template subspecification s.
| Name | Link |
|---|---|
| Philips Hue | TODO |
| ECHONET | TODO |
| OPC-UA | TODO |
Depending on the platform and the variety of devices it proposes, each platform binding template subspecification will be structured differently. When the platforms offer a reasonable set of device types, a Thing Model for each device type SHOULD be provided. In other cases, possible devices SHOULD be generalized by providing a set of example Thing Models or TDs. In all cases, the following information SHOULD be provided:
This section is non-normative.
The
following
TD
examples
uses
CoAP
and
MQTT
Protocol
Binding
Templates.
These
TD
Context
Extensions
assume
that
there
is
a
CoAP
and
MQTT
in
RDF
vocabulary
similar
to
[
HTTP-in-RDF10
]
that
is
accessible
via
the
namespace
http://www.example.org/coap-binding#
and
http://www.example.org/mqtt-binding#
,
respectively.
The
supplemented
cov:methodName
member
instructs
the
Consumer
which
CoAP
method
has
to
be
applied
(e.g.,
GET
for
the
CoAP
Method
Code
0.01,
POST
for
the
CoAP
Method
Code
0.02,
or
iPATCH
for
CoAP
Method
Code
0.07).
The
supplemented
"mqv:controlPacketValue"
member
instructs
the
Consumer
which
MQTT
command
has
to
be
applied
(e.g.,
8
for
the
subscribing
and
10
for
unsubscribing).
A TD with simple payload format and protocols can be seen below. Here each interaction affordance has one form with one protocol.
{
"@context": [
"https://www.w3.org/2019/wot/td/v1",
{
"iot": "http://iotschema.org/",
"cov": "http://www.example.org/coap-binding#",
"mqv": "http://www.example.org/mqtt-binding#"
}
],
"@type": [ "Thing", "iot:Light", "iot:LevelCapability", "iot:BinarySwitchCapability" ],
"base": "http://example.com",
"title": "Lamp",
"id": "urn:dev:ops:32473-WoTLamp-1234",
"securityDefinitions": {"basic_sc": {
"scheme": "basic",
"in": "header"
}},
"security": ["basic_sc"],
"properties": {
"switchState": {
"@type": ["iot:SwitchStatus", "iot:SwitchData"],
"type": "boolean",
"writeOnly": false,
"readOnly": false,
"observable": false,
"forms": [
{
"href": "/example/light/currentswitch",
"op": ["readproperty", "writeproperty"],
"contentType": "application/json"
}
]
},
"brightness": {
"@type": ["iot:CurrentLevel", "iot:LevelData"],
"type": "number",
"writeOnly": false,
"readOnly": false,
"observable": false,
"forms": [
{
"href": "coap://example.com/example/light/currentdimmer",
"op": ["readproperty", "writeproperty"],
"contentType": "application/json"
}
]
}
},
"actions": {
"switchOn": {
"@type": ["iot:SwitchOnAction"],
"input": {
"type": "boolean",
"const": true
},
"forms": [
{
"href": "/example/light/currentswitch",
"op": ["invokeaction"],
"contentType": "application/json"
}
]
},
"switchOff": {
"@type": ["iot:SwitchOff"],
"input": {
"type": "boolean",
"const": false
},
"forms": [
{
"href": "/example/light/currentswitch",
"op": ["invokeaction"],
"contentType": "application/json"
}
]
},
"setBrightness": {
"@type": ["iot:SetLevelAction"],
"input": {
"@type": ["iot:LevelData"],
"type": "number"
},
"forms": [
{
"href": "/example/light/currentdimmer",
"op": ["invokeaction"],
"contentType": "application/json"
}
]
}
}
}
Another
version
of
the
previous
TD
with
complex
payload
and
multiple
protocol
options
is
shown
below.
Notably,
the
brightness
property
can
be
read
via
HTTP,
written
to
via
CoAP
and
observed
via
MQTT.
{
"@context": [
"https://www.w3.org/2019/wot/td/v1",
{
"iot": "http://iotschema.org/",
"cov": "http://www.example.org/coap-binding#",
"mqv": "http://www.example.org/mqtt-binding#"
}
],
"base": "http://example.com/",
"@type": [ "Thing", "iot:Light", "iot:LevelCapability", "iot:BinarySwitch" ],
"title": "Lamp",
"id": "urn:dev:ops:32473-WoTLamp-1234",
"securityDefinitions": {"basic_sc": {
"scheme": "basic",
"in": "header"
}},
"security": ["basic_sc"],
"properties": {
"switchState": {
"@type": ["iot:SwitchStatus"],
"type": "object",
"properties": {
"switch": {
"@type": ["iot:SwitchData"],
"type": "boolean"
}
},
"writeOnly": false,
"readOnly": false,
"observable": true,
"forms": [
{
"href": "/example/light/currentswitch",
"contentType": "application/json",
"op": ["readproperty"],
"htv:methodName": "GET"
},
{
"href": "/example/light/currentswitch",
"contentType": "application/json",
"op": ["writeproperty"],
"htv:methodName": "POST"
},
{
"href": "mqtt://example.com/example/light/currentswitch",
"op": ["observeproperty"],
"mqv:controlPacketValue": "SUBSCRIBE"
}
]
},
"brightness": {
"@type": ["iot:CurrentLevel"],
"type": "object",
"properties": {
"brightness": {
"@type": ["iot:LevelData" ],
"type": "integer",
"minimum": 0,
"maximum": 255
}
},
"writeOnly": false,
"readOnly": false,
"observable": true,
"forms": [
{
"href": "coap://example.com/example/light/currentdimmer",
"contentType": "application/json",
"op": ["readproperty"],
"cov:methodName": "GET"
},
{
"href": "/example/light/currentdimmer",
"contentType": "application/json",
"op": ["writeproperty"],
"htv:methodName": "POST"
},
{
"href": "mqtt://example.com/example/light/currentdimmer",
"op": ["observeproperty"],
"mqv:controlPacketValue": "SUBSCRIBE"
}
]
},
"transitionTime": {
"@type": ["iot:TransitionTime"],
"type": "object",
"properties": {
"transitionTime": {
"@type": ["iot:TransitionTimeData" ],
"type": "integer",
"minimum": 0,
"maximum": 255
}
},
"writeOnly": false,
"readOnly": false,
"observable": false,
"forms": [
{
"href": "/example/light/transitiontime",
"contentType": "application/json",
"op": ["readproperty"],
"htv:methodName": "GET"
},
{
"href": "/example/light/transitiontime",
"contentType": "application/json",
"op": ["writeproperty"],
"htv:methodName": "POST"
}
]
}
},
"actions": {
"switchOn": {
"@type": ["iot:SwitchOnAction"],
"input": {
"type": "boolean",
"const": true
},
"forms": [
{
"href": "/example/light/currentswitch",
"contentType": "application/json",
"op": ["invokeaction"],
"htv:methodName": "POST"
}
]
},
"switchOff": {
"@type": ["iot:SwitchOffAction"],
"input": {
"type": "boolean",
"const": false
},
"forms": [
{
"href": "/example/light/currentswitch",
"contentType": "application/json",
"op": ["invokeaction"],
"htv:methodName": "POST"
}
]
},
"setBrightness": {
"title": "Set Brightness Level",
"@type": ["iot:SetLevelAction"],
"input": {
"type": "object",
"properties": {
"brightness": {
"@type": ["iot:LevelData"],
"type": "integer",
"minimum": 0,
"maximum": 255
}
},
"transitionTime": {
"@type": ["iot:TransitionTimeData"],
"type": "integer",
"minimum": 0,
"maximum": 65535
}
},
"forms": [
{
"href": "/example/light/",
"contentType": "application/json",
"op": ["invokeaction"],
"htv:methodName": "POST"
}
]
}
}
}
Security and privacy considerations are still under discussion and development; the content below should be considered preliminary. Due to the complexity of the subject we are considering producing a separate document containing a detailed security and privacy considerations discussion including a risk analysis, threat model, recommended mitigations, and appropriate references to best practices. A summary will be included here. Work in progress is located in the WoT Security and Privacy repository. Please file any security or privacy considerations and/or concerns using the GitHub Issue feature.
Security is a cross-cutting issue that needs to be taken into account in all WoT building blocks. The W3C WoT does not define any new security mechanisms, but provides guidelines to apply the best practices from Web security, IoT security, and information security for general software and hardware considerations.
The WoT Thing Description must be used together with integrity protection mechanisms and access control policies. Users must ensure that no sensitive information is included in the TDs themselves.
The WoT Binding Templates must correctly cover the security mechanisms employed by the underlying IoT platform . Due to the automation of network interactions necessary in the IoT, operators need to ensure that Things are exposed and consumed in a way that is compliant with their security policies.
The WoT Runtime implementation for the WoT Scripting API must have mechanisms to prevent malicious access to the system and isolate scripts in multi-tenant Servients .
Special thanks to all active participants of the W3C Web of Things Interest Group and Working Group for their technical input and suggestions that led to improvements to this document.
As
an
extension
of
4.2.1.2
Data
Schemas
,
this
section
collects
examples
of
different
payloads
and
their
corresponding
DataSchema
.
These
are
from
well-known
IoT
Platforms
and
Standards
and
aim
to
illustrate
the
various
ways
a
payload
can
look
like
and
how
one
can
describe
it
with
a
Data
Schema.
SenML [ RFC8428 ] might use the following construct:
Example
8
:
SenML
Payload
Example
|
Example
9
:
Data
Schema
for
SenML
Payload
Example
|
A Batch Collection according to OCF[ OCF ] may be structured like this:
Example
10
:
OCF
Batch
Example
|
Example
11
:
Data
Schema
for
OCF
Batch
Payload
Example
|
And an IPSO Smart Object on LWM2M [ LWM2M ] might look like the following:
Example
12
:
IPSO/LWM2M
Payload
Example
|
Example
13
:
Data
Schema
for
IPSO/LWM2M
Payload
Example
|
The below chapters are copied from other places in this document. They require discussion on where to place them, i.e. either here or another document of the working group, or to be completely removed.
The form elements contain the URI [ RFC3986 ] pointing to an instance of the interaction and descriptions of the protocol settings and options expected to be used when between the Consumer and the Thing for the interaction.
Protocols
may
have
defined
sub-protocols
that
can
be
used
for
some
interaction
types.
For
example,
to
receive
asynchronous
notifications
using
HTTP,
some
servers
may
support
long
polling
(
longpoll
),
WebSub
[
WebSub
]
(
websub
)
and
Server-Sent
Events
[
eventsource
]
(
sse
).
The
subprotocol
item
may
be
defined
in
a
form
instance
to
indicate
the
use
of
one
of
these
protocols,
for
example
long
polling
with
its
special
use
of
HTTP:
{
"op": "subscribeevent",
"href": "https://mylamp.example.com/overheating",
"subprotocol": "longpoll"
}
The
subprotocol
field
is
defined
in
[
WOT-THING-DESCRIPTION
].
Currently,
the
supported
values
are
longpoll
,
websub
and
sse
defined
for
HTTP.
Subprotocols
can
be
used
for
asynchronous
event
delivery
or
observing
Properties.
For WebSockets, the IANA-registered Websocket Subprotocols [ iana-web-socket-registry ] may be used.
For
CoAP,
"subprotocol":"cov:observe"
can
be
used
to
describe
asynchronous
observation
operations
as
defined
by
[
RFC6741
]
This section is non-normative.
This section describes unique aspects of protocol bindings for the three WoT Interaction Affordances.
This section describes unique aspects of protocol bindings for WoT Property interactions.
The
abstract
operations
exposed
for
the
Property
Interaction
are
readproperty
,
writeproperty
,
observeproperty
and
unobserveproperty
.
These
are
mapped
by
using
form
operations
that
describe
how
the
abstract
operation
is
performed,
resulting
in
a
semantic
interpretation
similar
to
HTML
form
submission.
Additionally,
the
abstract
operations
exposed
for
multiple
Property
Interactions
are
readallproperties
,
writeallproperties
,
readmultipleproperties
and
writemultipleproperties
.
{
"op": "writeproperty",
"href": "/example/level",
"htv:methodName": "POST"
}
The
form
element
in
the
example
above
conveys
the
statement:
"To
do
a
writeproperty
of
the
subject
Property
(context
of
the
form),
perform
an
HTTP
POST
on
the
resource
at
the
target
URI
/example/level
."
Properties
may
be
observable,
defined
by
the
TD
keyword
"observable".
If
there
is
an
observe
form
and
a
retrieve
form,
the
observe
form
may
be
indicated
by
including
op=observeproperty
in
the
form.
The
observe
form
may
also
specify
header
options
to
use,
as
specified
in
Observing
in
CoAP[
RFC7641
]for
example
setting
the
CoAP
Observe
option
to
0
in
the
header,
starts
observation.
This section is non-normative.
This section describes unique aspects of protocol bindings for Actions.
The
abstract
operation
on
Actions
is
invokeaction
.
In
the
same
way
that
the
abstract
operations
on
Properties
are
mapped
using
form
operation
types,
the
abstract
operation
of
Actions
is
also
mapped.
{
"op": "invokeaction",
"href": "/example/levelaction",
"http:methodName": "POST"
}
The
form
element
in
the
example
above
conveys
the
statement:
"To
do
an
invokeaction
of
the
subject
Action
(context
of
the
form),
perform
a
POST
on
the
resource
at
the
target
URI
/example/levelaction
."
This section is non-normative.
This section describes unique aspects of protocol bindings for WoT Event Interaction Affordances.
The
abstract
operations
on
Events
are
subscribeevent
and
unsubscribeevent
.
The
subscribeevent
operation
may
directly
enable
event
instance
delivery
from
the
pre-defined
URI
to
observable
resources
or
pubsub
topics
encoded
in
URIs.
Alternatively,
it
may
return
a
location
or
resource
URI
from
which
event
instance
may
be
obtained,
either
by
observation
or
some
other
mechanism,
depending
on
the
transfer
protocol.
Usually,
the
unsubscribeevent
only
occurs
when
the
transfer
protocol
has
no
implicit
unsubscribe
operation
such
as
closing
the
connection.
Examples
are
Webhooks
that
require
particular
unsubscribe
requests.
If the binding offers an observable Event resource from which events are obtained, there will be a form which describes the required transfer layer operation, for example CoAP Observe or HTTP Long Polling.
{
"op": "subscribeevent",
"href": "mqtt://wot.example.com/levelevent",
"mqv:controlPacketValue": "SUBSCRIBE"
}
The
form
element
in
the
example
above
conveys
the
statement:
"To
do
an
subscribeevent
of
the
subject
Event
(context
of
the
form),
perform
an
MQTT
SUBSCRIBE
on
the
topic
/levelevent
on
the
broker
at
wot.example.com
using
the
default
MQTT
port."
Referenced in:
Referenced in: