Abstract

In the context of the Web of Things (WoT), a Binding Template is a blueprint that gives guidance on how to implement a specific IoT protocol, data format or IoT platform. The Core Binding Templates specification explains the overall mechanism and requirements for any binding to follow. This document gives implementation guidelines regarding the Hypertext Transfer Protocol (HTTP), which is one of the most used protocols in the Internet to exchange any kind of data related to Webpages, Web APIs, IoT devices and much more.

More specifically, it defines a set of vocabulary terms that can be used inside a Thing Description document, and associated rules which allow to describe WoT operations using HTTP over the network. Additionally, relevant examples are provided to showcase different vocabulary terms and the associated behavior.

Introduction

the following is a draft introduction

This document describes how to map the HTTP protocol to the W3C Web of Things. At the current state of the WoT specifications, this document mirrors the vocabulary terms and defaults that are defined in the [[WOT-THING-DESCRIPTION]] (see Section on Protocol Binding based on HTTP).

This document is a work in progress

HTTP Vocabulary

HTTP Vocabulary Terms

Vocabulary term Description Assignment Type
htv:methodName HTTP method name (Literal). optional string

(one of "GET", "PUT", "POST", "DELETE", "PATCH")

htv:headers HTTP headers sent with the message. optional array of htv:MessageHeader
htv:fieldName Header name (Literal), e.g., "Accept", "Transfer-Encoding". mandatory within htv:MessageHeader string
htv:fieldValue Header value (Literal). To be used together with htv:fieldName inside a htv:MessageHeader optional string

HTTP Default Vocabulary Terms

op value Default Binding
readproperty "htv:methodName": "GET"
writeproperty "htv:methodName": "PUT"
invokeaction "htv:methodName": "POST"
readallproperties "htv:methodName": "GET"
writeallproperties "htv:methodName": "PUT"
readmultipleproperties "htv:methodName": "GET"
writemultipleproperties "htv:methodName": "PUT"

Example Sequences of Interaction Affordances

This section illustrates example sequences of application and protocol transactions that correspond to operations (defined in the Thing Description Specification) implementing various interactions among WoT Consumer and WoT Things. The illustrations show both the concrete protocol transactions and the interactions between the applications running inside the WoT Consumer and WoT Thing and the Consumed Thing and Exposed Thing abstractions.

For the sake of simplicity, remote and local proxies between the Consumer and the Thing are omitted from the following sequences. We also assume HTTP as the concrete protocol and omit any additional transactions for implementing security, such as those that would be used for authentication or to set up a secure connection for HTTPS. Other concrete protocols and the addition of security transactions however would only affect the concrete protocol transactions, not the application-level interactions with the Consumed Thing and Exposed Thing abstractions.

Property Interactions

Read property (HTTP binding)

The following sequence illustrates application and network transactions to implement the readproperty operation with an HTTP protocol binding.

Read property (HTTP binding)

Write property (HTTP binding)

The following sequence illustrates application and network transactions to implement the writeproperty operation with an HTTP protocol binding.

Write property (HTTP binding)

Observe property (HTTP binding with Long Polling subprotocol)

The following sequence illustrates application and network transactions to implement the observeproperty operation with an HTTP protocol binding using the "longpolling" (Long Polling) subprotocol.

Observe property (HTTP binding with Long Polling subprotocol)

Observe property (HTTP binding with Server Sent Event subprotocol)

The following sequence illustrates application and network transactions to implement the observeproperty operation with an HTTP protocol binding using the "sse" (Server Sent Event) subprotocol.

Observe property (HTTP binding with Server Sent Event subprotocol)

Observe property (HTTP binding with WebSocket subprotocol)

The following sequence illustrates application and network transactions to implement the observeproperty operation with an HTTP protocol binding using a WebSocket-based subprotocol.

Observe property (HTTP binding with a WebSocket subprotocol)

Action Interactions

Invoke action (HTTP binding)

The following sequence illustrates application and network transactions to implement the invokeaction operation with an HTTP protocol binding, where the operation is synchronous and the response from the server is delayed until after the action completes.

Invoke action (HTTP binding)

Event Interactions

In the following, note that there is no explicit operation defined for event notification itself. The subprotocol used for notification is associated with the subscribeevent operation, and any necessary concrete protocol transactions are managed by the Protocol Binding subsystem.

There are also several subprotocols possible for event notification using WebSockets. The interaction diagrams show only one of several possible implementations.

Subscribe, notify and unsubscribe event (HTTP binding with Long Polling subprotocol)

The following sequence illustrates application and network transactions to implement the subscribeevent and unsubscribeevent operations with an HTTP protocol binding using the Long Polling subprotocol.

Subscribe, notify, and unsubscribe event (HTTP binding with Long Polling subprotocol)

Subscribe, notify and unsubscribe event (HTTP binding with Server Sent Event subprotocol)

The following sequence illustrates application and network transactions to implement the subscribeevent and unsubscribeevent operations with an HTTP protocol binding using the Server Sent Event subprotocol.

Subscribe, notify and unsubscribe event (HTTP binding with Server Sent Event subprotocol)

Subscribe, notify and unsubscribe event (HTTP binding with WebSocket subprotocol)

The following sequence illustrates application and network transactions to implement the subscribeevent and unsubscribeevent operations with an HTTP protocol binding using a WebSocket subprotocol.

Subscribe, notify and unsubscribe event (HTTP binding with WebSocket subprotocol)

Deploys by Netlify