REST and the Internet of Things
It has been over a decade since people started to talk about Ubiquitous Computing or the Internet of Things (almost three decades for the former). Back then it was a dream, more or less. Today it is a reality, with many of us surrounded by several "internet capable" devices at every moment. There has been a lot of work recently in some standards groups (e.g., IETF) on various aspects surrounding the Internet of Things (IoT), including the Concise Binary Object Representation (CBOR) protocol (how to cram as much data into a small message exchange as possible).
The Concise Binary Object Representation (CBOR) is a data format whose design goals include the possibility of extremely small code size, fairly small message size, and extensibility without the need for version negotiation. These design goals make it different from earlier binary serializations such as ASN.1 and MessagePack.
But it was only a matter of time before REST would be applied to this area. The Constrained RESTful Environments (CoRE) working group is chartered by the IETF to provide:
[...] a framework for resource-oriented applications intended to run on constrained IP networks. A constrained IP network has limited packet sizes, may exhibit a high degree of packet loss, and may have a substantial number of devices that may be powered off at any point in time but periodically "wake up" for brief periods of time.
As part of this framework for building applications on constrained devices the working group will also define the Constrained Application Protocol (CoAP) for the manipulation of resources on these devices:
The WG will define a mapping from CoAP to an HTTP REST API; this mapping will not depend on a specific application. It is worth noting that proxy does not have to occur at the boundary between the constrained network and the more general network, but can be deployed at various locations in the unconstrained network.
The group has already defined a number of items that the protocol must support, including:
- The ability to create, read, update and delete a resource on a device.
- The ability to support a non-reliable multicast message to be sent to a group of devices.
- It must operate over UDP, with some optional (and limited) support for TCP.
- specification for the HTTP REST based API and translation to communicate with devices.
Since the group has only just started there are still a number of unknowns, such as security. However, there's already a project to support CoAP on Java with jCoAP.
Is REST the right model for IOT?
MQTT is about asynchronous messaging and pub/sub which is not the domain of REST.
Also I am not clear on why we need COBR when we have Protocol Buffers from Google.
Re: Is REST the right model for IOT?
With ZeroMQ, binary protocol (i.e. serialization) can be freely choosen.