# Web of Things

## Summary


Web of Things (WoT) is a set of building blocks that seeks to make the Internet of Things (IoT) more interoperable and usable. It simplifies application development (including cross-domain applications) by adopting the web paradigm. Web developers will have a low barrier to entry when programming for the IoT.  

The key concepts of WoT include Thing Description, Thing Model, Interaction Model, Hypermedia Controls, Protocol Bindings, Profiles, Discovery and Binding Templates. IoT devices (aka Things) are treated as web resources, which makes WoT a Resource-Oriented Architecture (ROA). 

WoT is standardized by the W3C. There are developer tools and implementations. As of December 2023, widespread industry adoption of WoT is yet to happen. Highly resource-constrained devices that can't run a web stack will not be able to adopt WoT.

## Discussion

### Why do we need the Web of Things (WoT)?

The IoT ecosystem is fragmented. Applications or devices from different vendors don't talk to one another due to differing data models. Consumers need to use multiple mobile apps to interact with their IoT devices. While IoT has managed to network different devices via various connectivity protocols (Zigbee, IEEE 802.15.4, NB-IoT, Thread, etc.), there's a disconnect at the application layer. 

For developers, this disconnect translates to more effort integrating new devices and services. Each application exposes its own APIs. This results in tight coupling between clients and service providers. It's more effort maintaining and evolving these services. 

WoT brings interoperability at the application layer with a unifying data model. It reuses the web paradigm. IoT devices can be treated as web resources. Just as documents on the web are interlinked and easily navigated, Things can be linked, discovered, queried and acted upon. Mature web standards such as REST, HTTP, JSON, AJAX and URI can be used to achieve this.   This means that web developers can become IoT developers. They can create reusable IoT building blocks rather than custom proprietary implementations that work for limited use cases. 


### What integration patterns does WoT cover?

An IoT device can directly expose a WoT API. This is the simplest integration pattern. It's also challenging from a security perspective or if the device is behind a firewall. For more resource-constrained devices running LPWAN protocols, direct access is difficult. They would connect to the cloud via a gateway, which exposes the WoT API. When devices spread over a large area need to cooperate, they would connect to the cloud in different ways and the cloud exposes the WoT API.  

Let's consider specific use cases. A remote controller connects directly to an electrical appliance in a trusted environment. Similarly, a sensor acting as a control agent connects to an electrical appliance. A remote control outside a trusted environment connects to a gateway or a edge device which then connects to an electrical appliance. Connected devices are mapped to digital twins that can be accessed via a client device. A device can be controlled via its digital twin in the cloud. These various integration patterns can be combined through system integration. 


### What's the architecture of WoT?

WoT standardizes a layered architecture of four layers (lower to higher): Access, Find, Share and Compose. The protocols or techniques used at each of these layers are already widely used on the web. These four layers can't be mapped to the OSI model, nor are they strictly defined at the interfaces. They're really a collection of services to ease the development of IoT solutions. 

At the access layer, solution architects have to think about resource, representation and interface designs. They should also define how resources are interlinked. At the find layer, web clients can discover root URLs, the syntax and semantics of interacting with Things. At the compose layer, tools such as Node-RED and IFTTT can help create mashups. 


### What are Thing Description (TD) and Thing Model (TM) in WoT?

TD is something like the business card of the Thing. It reveals everything about the Thing. It informs the protocol, data encoding, data structure, and security mechanism used by the Thing. TD itself is in JSON-LD format and is exposed by the Thing or can be discovered by consumers from a Thing Description Directory (TDD). 

In object-oriented programming, objects are instantiated from classes. Likewise, a TD can be seen as an instantiation of a TM. A TM is a logical description of a Thing's interface and interactions. However, it doesn't contain instance-specific information such as an IP address, serial number of GPS location. A TM can include security details if those are applicable for all instances of that TM. 

Both TD and TM are represented and serialized in JSON-LD format. Whereas a TD can be validated against its TM, a TM can't be validated. 


### What's the WoT interaction model?

Apart from links, a Thing may expose three types of interaction affordances: 

    + **Properties**: Property is a state of the Thing. State may be read-only or read-write. Properties can be made observable. Sensor values, stateful actuators, configuration, status and computation results are examples.
    + **Actions**: Action invokes a function of the Thing. Action can be used to update one or more properties including read-only ones.
    + **Events**: Event is used to asynchronously send data from the Thing to a consumer. Focus is on state transitions rather than the state itself. Examples include alarms or samples of a time series.Like documents on the web, WoT also links and forms. These are called **hypermedia controls**. Links are used to discover and interlink Things. Forms enable more complex operations than what's possible by simply dereferencing a URI. 


### What are protocol bindings in WoT?

WoT's abstractions make it protocol agnostic. It doesn't matter if a Thing uses MQTT, CoAP, Modbus or any other connectivity protocol. WoT's interaction model unifies all these so that applications talk in terms of properties, actions and events. But abstractions have to be translated into protocol actions. This is provided by **protocol bindings**. For a door handle for example, protocol binding tells how to open/close the door at the level of knob or lever. 

W3C has published a non-normative document called **WoT Binding Templates**. This gives blueprints on how to write TDs for different IoT platforms or standards. This includes protocol-specific metadata, payload formats, and usage in specific IoT platforms. The consumer of a TD would implement the template, that is, the protocol stack, media type encoder/decoder and platform stack. 


### Who has implemented WoT?

W3C maintains a list of developer resources. This include tools, implementations, TD directories and WoT middleware. For example, Eclipse Thingweb is a Node.js implementation to expose and consume TD. From other sources, there are implementations in Python, Java, Rust and Dart. Among the TD directories are TinyIoT Thing Directory and WoTHive.  Major WoT deployments during 2012-2021 have been documented. 

Krellian Ltd. offers WebThings Gateway and WebThings Framework. WebThings was initially developed at Mozilla. However, its API differs from W3C specifications in many ways. 

The sayWoT! platform from evosoft (a Siemens subsidiary) gives web and cloud developers an easy way to develop IoT solutions. One study compared many WoT platforms including WoT-SDN, HomeWeb, KNX-WoT, EXIP, WTIF, SOCRADES, WoTKit, µWoTO, and more. 

WoT is being leveraged to create digital twins. WoTwins and Eclipse Ditto with WoT integration are examples of this. Ortiz et al. used WoT TD effectively in real-time IoT data processing in smart ports use case. WoTemu is an emulation framework for WoT edge architecture. 


### What standards cover WoT?

The W3C is standardizing WoT. The following are the main normative specifications: 

    + WoT Architecture 1.1 (Recommendation)
    + WoT Thing Description 1.1 (Recommendation)
    + WoT Discovery (Recommendation)
    + WoT Profile (Working Draft)Informative specifications include WoT Scripting API, WoT Binding Templates, WoT Security and Privacy Guidelines, and WoT Use Cases and Requirements. 

Beginners can start at the W3C WoT webpage for latest updates, community groups, documentation and tooling.

At the IETF, there's a draft titled *Guidance on RESTful Design for Internet of Things Systems*. This is relevant to WoT. 


### What are some limitations of WoT?

WoT depends on the web stack. Hence, it's not suited for very low-power devices or mesh deployments. 

**Matter** protocol, known earlier as Project CHIP, is an alternative to WoT. This is promoted by the Connectivity Standards Alliance (CSA), formerly called Zigbee Alliance. Matter is based on Thread, IPv6 and Dotdot. While Matter is not web friendly like WoT, it appears to have better industry traction.  However, Matter devices that expose WoT TDs can talk to WoT devices. 

There's a claim that WoT hasn't adequately addressed security, privacy and data sharing issues. This is especially important when IoT devices are directly exposed to the web. Devices are energy inefficient since they're always on. They're vulnerable to DoS attacks. 

WoT alone can't solve complex problems such as optimize workflows across many IoT devices or applications. Hypermedea and EnvGuard are two approaches to solve this. Larian et al. compared many WoT platforms. They noted that current IoT middleware and WoT resource discovery need to be improved. Legacy systems would require custom code to interface to the WoT architecture. 

## Milestones

Nov  
2007

Wilde uses the term "Web of Things" in a paper titled *Putting Things to REST*. He makes the case for treating a Thing (such as a sensor) as a web resource. It could then be accessed via RESTful calls rather than the more restrictive SOAP/WSDL API calls. Web concepts of URI, HTTP, HTML, XML and loosely coupling can be applied effectively towards Things.  

2011

Guinard publishes his Doctor of Science dissertation in the field of Web of Things. In 2016, he co-authors (with Trifa) a book titled *Building the Web of Things*. Guinard sees WoT as

> A refinement of the Internet of Things (IoT) by integrating smart things not only into the Internet (the network), but into the Web (the application layer).

Jul  
2013

**Web of Things Community Group** is created. Subsequently in 2014, a workshop is held (June) and an Interest Group is formed (November). 

Dec  
2016

Following the first in-person meeting and a WoT Plugfest in 2015, the **W3C WoT Working Group** is formed. It's aim is to produce two normative specifications (Architecture, Thing Description) and two informative specifications (Scripting API, Binding Templates). 

Jun  
2018

From the Eclipse Foundation, the first commit on GitHub is made for the **Eclipse Thingweb** project. The project aims to provide Node.js components and tools for developers to build IoT systems that conform to W3C WoT standards. The project releases v0.5.0 in October. 

Apr  
2020

W3C publishes WoT Architecture and WoT Thing Description as separate **W3C Recommendation** documents. 

Jul  
2022

Tzavaras et al. propose using **OpenAPI** descriptions and ontologies to bring Things closer to the world of Semantic Web. Thing Descriptions can be created in OpenAPI while also conforming to W3C WoT architecture. They argue that OpenAPI is already a mature standard. It provides a uniform way to interact with web services and Things. 

Nov  
2022

Markus Reigl at Siemens comments that WoT will do for IoT what HTML did for the WWW in the 1990s. TD is not a mere concept. It leads to executable software code. He predicts IoT standardization will gain momentum. 

Dec  
2023

W3C publishes WoT Architecture 1.1 and WoT Thing Description 1.1 as W3C Recommendation documents. In addition, WoT Discover is also published as a W3C Recommendation.