To be defined

Introduction

the following is a draft introduction

This document describes how to map the MQTT protocol to the W3C Web of Things.

Forms of a Thing Description instance with MQTT Binding complies with this specification if it follows the normative statements in and .

A JSON Schema [[?JSON-SCHEMA]] to validate Thing Description instances containing MQTT Binding is provided in the GitHub repository.

This document is a work in progress

URL format

There is no clear consensus on the correct URL format for MQTT protocol binding

MQTT Vocabulary

Form terms

Vocabulary term Description Assignment Type
mqv:controlPacketValue MQTT Control Packet type (Literal). optional string

(one of "PUBLISH" (3), "SUBSCRIBE" (8), "UNSUBSCRIBE" (10))

mqv:options MQTT options sent with the message, e.g., [ { "mqv:optionName": "qos", "mqv:optionValue": 1 }]. optional array of mqv:MessageOption
mqv:optionName Option name (Literal). mandatory within mqv:MessageOption) string

(one of "qos", "retain", "dup")

mqv:optionValue Header value (Literal). mandatory within mqv:MessageOption) One of 0, 1 or 2 (only for qos)

Mappings

This section describes strategies and default values to employ protocol specific concepts within the WoT Interaction model.

Default mappings

op value Default Binding
readproperty "mqv:controlPacketValue": "SUBSCRIBE"
writeproperty "mqv:controlPacketValue": "PUBLISH"
observeproperty "mqv:controlPacketValue": "SUBSCRIBE"
unobserveproperty "mqv:controlPacketValue": "UNSUBSCRIBE"
invokeaction "mqv:controlPacketValue": "PUBLISH"
subscribeevent "mqv:controlPacketValue": "SUBSCRIBE"
unsubscribeevent "mqv:controlPacketValue": "UNSUBSCRIBE"
readallproperties "mqv:controlPacketValue": "SUBSCRIBE"
writeallproperties "mqv:controlPacketValue": "PUBLISH"
readmultipleproperties "mqv:controlPacketValue": "SUBSCRIBE"
writemultipleproperties "mqv:controlPacketValue": "PUBLISH"

Possible mappings

For the MQTT protocol, if an MQTT client publishes a message to a topic with the retain flag set to true, the future subscribers of the topic will also get this message. Outside of this case, it is not possible to read a property but only possible to observe it. Additionally, in a Form element with MQTT protocol, if the op contains readproperty (meaning that retain flag is set to true), it SHOULD also contain observeproperty. On the other hand, if the MQTT publisher does not set the retain flag to true, the property will be only observable. In this case, the property in the exposed Thing Description SHOULD NOT have Form elements with MQTT protocol containing readproperty operation.

Examples

The following examples show how to use the MQTT protocol in a Thing Description.

TODO: