draft-ietf-core-coap-pubsub-04.txt   draft-ietf-core-coap-pubsub-05.txt 
Network Working Group M. Koster Network Working Group M. Koster
Internet-Draft SmartThings Internet-Draft SmartThings
Intended status: Standards Track A. Keranen Intended status: Standards Track A. Keranen
Expires: September 6, 2018 J. Jimenez Expires: January 3, 2019 J. Jimenez
Ericsson Ericsson
March 05, 2018 July 2, 2018
Publish-Subscribe Broker for the Constrained Application Protocol (CoAP) Publish-Subscribe Broker for the Constrained Application Protocol (CoAP)
draft-ietf-core-coap-pubsub-04 draft-ietf-core-coap-pubsub-05
Abstract Abstract
The Constrained Application Protocol (CoAP), and related extensions The Constrained Application Protocol (CoAP), and related extensions
are intended to support machine-to-machine communication in systems are intended to support machine-to-machine communication in systems
where one or more nodes are resource constrained, in particular for where one or more nodes are resource constrained, in particular for
low power wireless sensor networks. This document defines a publish- low power wireless sensor networks. This document defines a publish-
subscribe broker for CoAP that extends the capabilities of CoAP for subscribe Broker for CoAP that extends the capabilities of CoAP for
supporting nodes with long breaks in connectivity and/or up-time. supporting nodes with long breaks in connectivity and/or up-time.
Status of This Memo Status of This Memo
This Internet-Draft is submitted in full conformance with the This Internet-Draft is submitted in full conformance with the
provisions of BCP 78 and BCP 79. provisions of BCP 78 and BCP 79.
Internet-Drafts are working documents of the Internet Engineering Internet-Drafts are working documents of the Internet Engineering
Task Force (IETF). Note that other groups may also distribute Task Force (IETF). Note that other groups may also distribute
working documents as Internet-Drafts. The list of current Internet- working documents as Internet-Drafts. The list of current Internet-
Drafts is at http://datatracker.ietf.org/drafts/current/. Drafts is at http://datatracker.ietf.org/drafts/current/.
Internet-Drafts are draft documents valid for a maximum of six months Internet-Drafts are draft documents valid for a maximum of six months
and may be updated, replaced, or obsoleted by other documents at any and may be updated, replaced, or obsoleted by other documents at any
time. It is inappropriate to use Internet-Drafts as reference time. It is inappropriate to use Internet-Drafts as reference
material or to cite them other than as "work in progress." material or to cite them other than as "work in progress."
This Internet-Draft will expire on September 6, 2018. This Internet-Draft will expire on January 3, 2019.
Copyright Notice Copyright Notice
Copyright (c) 2018 IETF Trust and the persons identified as the Copyright (c) 2018 IETF Trust and the persons identified as the
document authors. All rights reserved. document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal This document is subject to BCP 78 and the IETF Trust's Legal
Provisions Relating to IETF Documents Provisions Relating to IETF Documents
(http://trustee.ietf.org/license-info) in effect on the date of (http://trustee.ietf.org/license-info) in effect on the date of
publication of this document. Please review these documents publication of this document. Please review these documents
skipping to change at page 2, line 17 skipping to change at page 2, line 17
Table of Contents Table of Contents
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2
2. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 3 2. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 3
3. Architecture . . . . . . . . . . . . . . . . . . . . . . . . 4 3. Architecture . . . . . . . . . . . . . . . . . . . . . . . . 4
3.1. CoAP Pub/sub Architecture . . . . . . . . . . . . . . . . 4 3.1. CoAP Pub/sub Architecture . . . . . . . . . . . . . . . . 4
3.2. CoAP Pub/sub Broker . . . . . . . . . . . . . . . . . . . 4 3.2. CoAP Pub/sub Broker . . . . . . . . . . . . . . . . . . . 4
3.3. CoAP Pub/sub Client . . . . . . . . . . . . . . . . . . . 5 3.3. CoAP Pub/sub Client . . . . . . . . . . . . . . . . . . . 5
3.4. CoAP Pub/sub Topic . . . . . . . . . . . . . . . . . . . 5 3.4. CoAP Pub/sub Topic . . . . . . . . . . . . . . . . . . . 5
3.5. Brokerless Pub/sub . . . . . . . . . . . . . . . . . . . 5 3.5. brokerless Pub/sub . . . . . . . . . . . . . . . . . . . 5
4. CoAP Pub/sub REST API . . . . . . . . . . . . . . . . . . . . 6 4. CoAP Pub/sub REST API . . . . . . . . . . . . . . . . . . . . 6
4.1. DISCOVERY . . . . . . . . . . . . . . . . . . . . . . . . 6 4.1. DISCOVERY . . . . . . . . . . . . . . . . . . . . . . . . 6
4.2. CREATE . . . . . . . . . . . . . . . . . . . . . . . . . 8 4.2. CREATE . . . . . . . . . . . . . . . . . . . . . . . . . 8
4.3. PUBLISH . . . . . . . . . . . . . . . . . . . . . . . . . 10 4.3. PUBLISH . . . . . . . . . . . . . . . . . . . . . . . . . 11
4.4. SUBSCRIBE . . . . . . . . . . . . . . . . . . . . . . . . 13 4.4. SUBSCRIBE . . . . . . . . . . . . . . . . . . . . . . . . 13
4.5. UNSUBSCRIBE . . . . . . . . . . . . . . . . . . . . . . . 14 4.5. UNSUBSCRIBE . . . . . . . . . . . . . . . . . . . . . . . 15
4.6. READ . . . . . . . . . . . . . . . . . . . . . . . . . . 16 4.6. READ . . . . . . . . . . . . . . . . . . . . . . . . . . 16
4.7. REMOVE . . . . . . . . . . . . . . . . . . . . . . . . . 17 4.7. REMOVE . . . . . . . . . . . . . . . . . . . . . . . . . 18
5. CoAP Pub/sub Operation with Resource Directory . . . . . . . 18 5. CoAP Pub/sub Operation with Resource Directory . . . . . . . 19
6. Sleep-Wake Operation . . . . . . . . . . . . . . . . . . . . 19 6. Sleep-Wake Operation . . . . . . . . . . . . . . . . . . . . 20
7. Simple Flow Control . . . . . . . . . . . . . . . . . . . . . 19 7. Simple Flow Control . . . . . . . . . . . . . . . . . . . . . 20
8. Security Considerations . . . . . . . . . . . . . . . . . . . 20 8. Security Considerations . . . . . . . . . . . . . . . . . . . 20
9. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 21 9. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 21
9.1. Resource Type value 'core.ps' . . . . . . . . . . . . . . 21 9.1. Resource Type value 'core.ps' . . . . . . . . . . . . . . 22
9.2. Resource Type value 'core.ps.discover' . . . . . . . . . 21 9.2. Resource Type value 'core.ps.discover' . . . . . . . . . 22
9.3. Response Code value '2.07' . . . . . . . . . . . . . . . 21 9.3. Response Code value '2.07' . . . . . . . . . . . . . . . 22
10. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 21 10. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 22
11. References . . . . . . . . . . . . . . . . . . . . . . . . . 22 11. References . . . . . . . . . . . . . . . . . . . . . . . . . 22
11.1. Normative References . . . . . . . . . . . . . . . . . . 22 11.1. Normative References . . . . . . . . . . . . . . . . . . 22
11.2. Informative References . . . . . . . . . . . . . . . . . 22 11.2. Informative References . . . . . . . . . . . . . . . . . 23
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 23 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 24
1. Introduction 1. Introduction
The Constrained Application Protocol (CoAP) [RFC7252] supports The Constrained Application Protocol (CoAP) [RFC7252] supports
machine-to-machine communication across networks of constrained machine-to-machine communication across networks of constrained
devices. CoAP uses a request/response model where clients make devices. CoAP uses a request/response model where clients make
requests to servers in order to request actions on resources. requests to servers in order to request actions on resources.
Depending on the situation the same device may act either as a server Depending on the situation the same device may act either as a server
or a client. or a client.
skipping to change at page 3, line 13 skipping to change at page 3, line 13
energy from their environment. These devices have limited energy from their environment. These devices have limited
reachability because they spend most of their time in a sleeping reachability because they spend most of their time in a sleeping
state with no network connectivity. Devices may also have limited state with no network connectivity. Devices may also have limited
reachability due to certain middle-boxes, such as Network Address reachability due to certain middle-boxes, such as Network Address
Translators (NATs) or firewalls. Such middle-boxes often prevent Translators (NATs) or firewalls. Such middle-boxes often prevent
connecting to a device from the Internet unless the connection was connecting to a device from the Internet unless the connection was
initiated by the device. initiated by the device.
This document specifies the means for nodes with limited reachability This document specifies the means for nodes with limited reachability
to communicate using simple extensions to CoAP. The extensions to communicate using simple extensions to CoAP. The extensions
enable publish-subscribe communication using a broker node that enable publish-subscribe communication using a Broker node that
enables store-and-forward messaging between two or more nodes. enables store-and-forward messaging between two or more nodes.
Furthermore the extensions facilitate many-to-many communication Furthermore the extensions facilitate many-to-many communication
using CoAP. using CoAP.
2. Terminology 2. Terminology
The key words 'MUST', 'MUST NOT', 'REQUIRED', 'SHALL', 'SHALL NOT', The key words 'MUST', 'MUST NOT', 'REQUIRED', 'SHALL', 'SHALL NOT',
'SHOULD', 'SHOULD NOT', 'RECOMMENDED', 'MAY', and 'OPTIONAL' in this 'SHOULD', 'SHOULD NOT', 'RECOMMENDED', 'MAY', and 'OPTIONAL' in this
specification are to be interpreted as described in [RFC2119]. specification are to be interpreted as described in [RFC2119].
This specification requires readers to be familiar with all the terms This specification requires readers to be familiar with all the terms
and concepts that are discussed in [RFC5988] and [RFC6690]. Readers and concepts that are discussed in [RFC5988] and [RFC6690]. Readers
should also be familiar with the terms and concepts discussed in should also be familiar with the terms and concepts discussed in
[RFC7252] and [I-D.ietf-core-resource-directory]. The URI template [RFC7252] and [I-D.ietf-core-resource-directory]. The URI template
format [RFC6570] is used to describe the REST interfaces defined in format [RFC6570] is used to describe the REST API defined in this
this specification. specification.
This specification makes use of the following additional terminology: This specification makes use of the following additional terminology:
Publish-Subscribe (pub/sub): A messaging paradigm where messages are Publish-Subscribe (pub/sub): A messaging paradigm where messages are
published to a broker and potential receivers can subscribe to the published to a Broker and potential receivers can subscribe to the
broker to receive messages. The publishers do not (need to) know Broker to receive messages. The publishers do not (need to) know
where the message will be eventually sent: the publications and where the message will be eventually sent: the publications and
subscriptions are matched by a broker and publications are subscriptions are matched by a Broker and publications are
delivered by the broker to subscribed receivers. delivered by the Broker to subscribed receivers.
CoAP pub/sub service: A group of REST resources, as defined in this CoAP pub/sub service: A group of REST resources, as defined in this
document, which together implement the required features of this document, which together implement the required features of this
specification. specification.
CoAP pub/sub Broker: A server node capable of receiving messages CoAP pub/sub Broker: A server node capable of receiving messages
(publications) from and sending messages to other nodes, and able (publications) from and sending messages to other nodes, and able
to match subscriptions and publications in order to route messages to match subscriptions and publications in order to route messages
to the right destinations. The broker can also temporarily store to the right destinations. The Broker can also temporarily store
publications to satisfy future subscriptions and pending publications to satisfy future subscriptions and pending
notifications. notifications.
CoAP pub/sub Client: A CoAP client which is capable of publish or CoAP pub/sub Client: A CoAP client which is capable of publish or
subscribe operations as defined in this specification. subscribe operations as defined in this specification.
Topic: A unique identifier for a particular item being published Topic: A unique identifier for a particular item being published
and/or subscribed to. A broker uses the topics to match and/or subscribed to. A Broker uses the topics to match
subscriptions to publications. A topic is a valid CoAP URI as subscriptions to publications. A topic is a valid CoAP URI as
defined in [RFC7252] defined in [RFC7252]
3. Architecture 3. Architecture
3.1. CoAP Pub/sub Architecture 3.1. CoAP Pub/sub Architecture
Figure 1 shows the architecture of a CoAP pub/sub service. CoAP pub/ Figure 1 shows the architecture of a CoAP pub/sub service. CoAP pub/
sub Clients interact with a CoAP pub/sub Broker through the CoAP pub/ sub Clients interact with a CoAP pub/sub Broker through the CoAP pub/
sub REST API which is hosted by the Broker. State information is sub REST API which is hosted by the Broker. State information is
skipping to change at page 4, line 47 skipping to change at page 4, line 47
|pub/sub|---------|------+ |pub/sub|---------|------+
|Client | | |Client | |
+-------+ | +-------+ |
Figure 1: CoAP pub/sub Architecture Figure 1: CoAP pub/sub Architecture
3.2. CoAP Pub/sub Broker 3.2. CoAP Pub/sub Broker
A CoAP pub/sub Broker is a CoAP Server that exposes a REST API for A CoAP pub/sub Broker is a CoAP Server that exposes a REST API for
clients to use to initiate publish-subscribe interactions. Avoiding clients to use to initiate publish-subscribe interactions. Avoiding
the need for direct reachability between clients, the broker only the need for direct reachability between clients, the Broker only
needs to be reachable from all clients. The broker also needs to needs to be reachable from all clients. The Broker also needs to
have sufficient resources (storage, bandwidth, etc.) to host CoAP have sufficient resources (storage, bandwidth, etc.) to host CoAP
resource services, and potentially buffer messages, on behalf of the resource services, and potentially buffer messages, on behalf of the
clients. clients.
3.3. CoAP Pub/sub Client 3.3. CoAP Pub/sub Client
A CoAP pub/sub Client interacts with a CoAP pub/sub Broker using the A CoAP pub/sub Client interacts with a CoAP pub/sub Broker using the
CoAP pub/sub REST API defined in this document. Clients initiate CoAP pub/sub REST API defined in this document. Clients initiate
interactions with a CoAP pub/sub broker. A data source (e.g., sensor interactions with a CoAP pub/sub Broker. A data source (e.g., sensor
clients) can publish state updates to the broker and data sinks clients) can publish state updates to the Broker and data sinks
(e.g., actuator clients) can read from or subscribe to state updates (e.g., actuator clients) can read from or subscribe to state updates
from the broker. Application clients can make use of both publish from the Broker. Application clients can make use of both publish
and subscribe in order to exchange state updates with data sources and subscribe in order to exchange state updates with data sources
and data sinks. and data sinks.
3.4. CoAP Pub/sub Topic 3.4. CoAP Pub/sub Topic
The clients and broker use topics to identify a particular resource The clients and Broker use topics to identify a particular resource
or object in a publish-subscribe system. Topics are conventionally or object in a publish-subscribe system. Topics are conventionally
formed as a hierarchy, e.g. "/sensors/weather/barometer/pressure" or formed as a hierarchy, e.g. "/sensors/weather/barometer/pressure" or
"EP-33543/sen/3303/0/5700". The topics are hosted at the broker and "/EP-33543/sen/3303/0/5700". The topics are hosted by a Broker and
all the clients using the broker share the same namespace for topics. all the clients using the Broker share the same namespace for topics.
Every CoAP pub/sub topic has a link, consisting of a reference path Every CoAP pub/sub topic has an associated link, consisting of a
on the broker using URI path [RFC3986] construction and link reference path on the Broker using URI path [RFC3986] construction
attributes [RFC6690]. Every topic is associated with zero or more and link attributes [RFC6690]. Every topic is associated with zero
stored representations with a content-format specified in the link. or more stored representations and a content-format specified in the
A CoAP pub/sub topic value may alternatively be a collection of one link. A CoAP pub/sub topic value may alternatively consist of a
or more sub-topics, consisting of links to the sub-topic URIs and collection of one or more sub-topics, consisting of links to the sub-
indicated by a link-format content-format. topic URIs and indicated by a link-format content-format. Sub-topics
are also topics and may have their own sub-topics, forming a tree
structure of unique paths that is implemented using URIs. The full
URI of a topic includes a schems and authority for the Broker, for
example "coaps://10.0.0.13:5684/EP-33543/sen/3303/0/5700".
3.5. Brokerless Pub/sub 3.5. brokerless Pub/sub
Figure 2 shows an arrangement for using CoAP pub/sub in a Figure 2 shows an arrangement for using CoAP pub/sub in a
"brokerless" configuration between peer nodes. Nodes in a brokerless "Brokerless" configuration between peer nodes. Nodes in a Brokerless
system may act as both broker and client. The Broker interface in a system may act as both Broker and client. A node that supports
brokerless node may be pre-configured with topics that expose Broker functionality may be pre-configured with topics that expose
services and resources. Brokerless peer nodes can be mixed with services and resources. Brokerless peer nodes can be mixed with
client and broker nodes in a system with full interoperability. client and Broker nodes in a system with full interoperability.
Peer pub/sub Peer Peer pub/sub Peer
+-------+ | +-------+ +-------+ | +-------+
| CoAP | | | CoAP | | CoAP | | | CoAP |
|pub/sub|---------|---------|pub/sub| |pub/sub|---------|---------|pub/sub|
|Client | | |Broker | |Client | | |Broker |
+-------+ | +-------+ +-------+ | +-------+
| CoAP | | | CoAP | | CoAP | | | CoAP |
|pub/sub|---------|---------|pub/sub| |pub/sub|---------|---------|pub/sub|
|Broker | | |Client | |Broker | | |Client |
skipping to change at page 6, line 22 skipping to change at page 6, line 35
section. Optimized implementations MAY support a subset of the section. Optimized implementations MAY support a subset of the
operations as required by particular constrained use cases. operations as required by particular constrained use cases.
4.1. DISCOVERY 4.1. DISCOVERY
CoAP pub/sub Clients discover CoAP pub/sub Brokers by using CoAP CoAP pub/sub Clients discover CoAP pub/sub Brokers by using CoAP
Simple Discovery or through a Resource Directory (RD) Simple Discovery or through a Resource Directory (RD)
[I-D.ietf-core-resource-directory]. A CoAP pub/sub Broker SHOULD [I-D.ietf-core-resource-directory]. A CoAP pub/sub Broker SHOULD
indicate its presence and availability on a network by exposing a indicate its presence and availability on a network by exposing a
link to the entry point of its pub/sub API at its .well-known/core link to the entry point of its pub/sub API at its .well-known/core
location [RFC6690]. A CoAP pub/sub broker MAY register its pub/sub location [RFC6690]. A CoAP pub/sub Broker MAY register its pub/sub
REST API entry point with a Resource Directory. Figure 3 shows an REST API entry point with a Resource Directory. Figure 3 shows an
example of a client discovering a local pub/sub API using CoAP Simple example of a client discovering a local pub/sub API using CoAP Simple
Discovery. A broker wishing to advertise the CoAP pub/sub API for Discovery. A Broker wishing to advertise the CoAP pub/sub API for
Simple Discovery or through a Resource Directory MUST use the link Simple Discovery or through a Resource Directory MUST use the link
relation rt=core.ps. A broker MAY advertise its supported content relation rt=core.ps. A Broker MAY advertise its supported content
formats and other attributes in the link to its pub/sub API. formats and other attributes in the link to its pub/sub API.
A CoAP pub/sub Broker MAY offer a topic discovery entry point to A CoAP pub/sub Broker MAY offer a topic discovery entry point to
enable Clients to find topics of interest, either by topic name or by enable Clients to find topics of interest, either by topic name or by
link attributes which may be registered when the topic is created. link attributes which may be registered when the topic is created.
Figure 4 shows an example of a client looking for a topic with a Figure 4 shows an example of a client looking for a topic with a
resource type (rt) of "temperature" using Discover. The client then resource type (rt) of "temperature" using Discover. The client then
receives the URI of the resource and its content-format. A pub/sub receives the URI of the resource and its content-format. A pub/sub
broker wishing to advertise topic discovery MUST use the relation Broker wishing to advertise topic discovery MUST use the relation
rt=core.ps.discover in the link. rt=core.ps.discover in the link.
A CoAP pub/sub Broker MAY expose the Discover interface through the A CoAP pub/sub Broker MAY provide topic discovery functionality
.well-known/core resource. Links to topics may be exposed at .well- through the .well-known/core resource. Links to topics may be
known/core in addition to links to the pub/sub API. Figure 5 shows exposed at .well-known/core in addition to links to the pub/sub API.
an example of topic discovery through .well-known/core. Figure 5 shows an example of topic discovery through .well-known/
core.
Topics in the broker may be created in hierarchies (see {create})
with parent topics having sub-topics. For a discovery the broker may
choose to not expose the sub-topics in order to limit amount of topic
links sent in a discovery response. The client can then perform
discovery for the parent topics it wants to discover the sub-topics.
The DISCOVER interface is specified as follows: The DISCOVER interface is specified as follows:
Interaction: Client -> Broker Interaction: Client -> Broker
Method: GET Method: GET
URI Template: {+ps}/{+topic}{?q*} URI Template: {+ps}/{+topic}{?q*}
URI Template Variables: ps := Pub/sub REST API entry point URI Template Variables: ps := Pub/sub REST API entry point
(optional). The entry point of the pub/sub REST API, as obtained (optional). The entry point of the pub/sub REST API, as obtained
from discovery, used to discover topics. from discovery, used to discover topics.
topic := The desired topic to return links for (optional). topic := The desired topic to return links for (optional).
q := Query Filter (optional). MAY contain a query filter list as q := Query Filter (optional). MAY contain a query filter list as
per [RFC6690] Section 4.1. per [RFC6690] Section 4.1.
Content-Format: application/link-format Content-Format: application/link-format
skipping to change at page 7, line 15 skipping to change at page 7, line 36
(optional). The entry point of the pub/sub REST API, as obtained (optional). The entry point of the pub/sub REST API, as obtained
from discovery, used to discover topics. from discovery, used to discover topics.
topic := The desired topic to return links for (optional). topic := The desired topic to return links for (optional).
q := Query Filter (optional). MAY contain a query filter list as q := Query Filter (optional). MAY contain a query filter list as
per [RFC6690] Section 4.1. per [RFC6690] Section 4.1.
Content-Format: application/link-format Content-Format: application/link-format
The following response codes are defined for this interface: The following response codes are defined for the DISCOVER operation:
Success: 2.05 "Content" with an application/link-format payload Success: 2.05 "Content" with an application/link-format payload
containing one or more matching entries for the broker resource. containing one or more matching entries for the Broker resource.
A pub/sub broker SHOULD use the value "/ps/" for the base URI of A pub/sub Broker SHOULD use the value "/ps/" for the base URI of
the pub/sub API wherever possible. the pub/sub API wherever possible.
Failure: 4.04 "Not Found" is returned in case no matching entry is Failure: 4.04 "Not Found" is returned in case no matching entry is
found for a unicast request. found for a unicast request.
Failure: 4.00 "Bad Request" is returned in case of a malformed Failure: 4.00 "Bad Request" is returned in case of a malformed
request for a unicast request. request for a unicast request.
Failure: No error response to a multicast request. Failure: No error response to a multicast request.
skipping to change at page 8, line 29 skipping to change at page 8, line 40
| Content-Format: application/link-format | | Content-Format: application/link-format |
| | | |
| <<-- 2.05 Content | | <<-- 2.05 Content |
| </ps/currentTemp>;rt="temperature";ct=50 ---| | </ps/currentTemp>;rt="temperature";ct=50 ---|
| | | |
Figure 5: Example of DISCOVER topic Figure 5: Example of DISCOVER topic
4.2. CREATE 4.2. CREATE
A CoAP pubsub broker SHOULD allow Clients to create new topics on the A CoAP pub/sub broker SHOULD allow Clients to create new topics on
broker using CREATE. Some exceptions are for fixed brokerless the broker using CREATE. Some exceptions are for fixed brokerless
devices and pre-configured brokers in dedicated installations. A devices and pre-configured brokers in dedicated installations. A
client wishing to create a topic MUST use CoAP POST to the pubsub API client wishing to create a topic MUST use a CoAP POST to the pub/sub
with a payload indicating the desired topic. The topic specification API with a payload indicating the desired topic. The topic
sent in the payload MUST use a supported serialization of the CoRE specification sent in the payload MUST use a supported serialization
link format [RFC6690]. The target of the link MUST be a URI of the CoRE link format [RFC6690]. The target of the link MUST be a
formatted string. The client MUST indicate the desired content URI formatted string. The client MUST indicate the desired content
format for publishes to the topic by using the ct (Content Format) format for publishes to the topic by using the ct (Content Format)
link attribute in the link-format payload. The client MAY indicate link attribute in the link-format payload. The client MAY indicate
the lifetime of the topic by including the Max-Age option in the the lifetime of the topic by including the Max-Age option in the
CREATE request. CREATE request.
Topics may be created as sub-topics of other topics. A client MAY
create a topic with a ct (Content Format) link attribute value which
describes a supported serialization of the CoRE link format [RFC6690]
such as application/link-format (ct=40) or its JSON or CBOR
serializations. If a topic is created which describes a link
serialization, that topic may then have sub-topics created under it
as shown in Figure 7.
Ony one level in the topic hierarchy may be created as a result of a
CREATE operation, unless create on PUBLISH is supported (see
Section 4.3). The topic string used in the link target MUST NOT
contain the "/" character.
A topic creator MUST include exactly one content format link
attribute value (ct) in the create payload. If the Broker does not
support the indicated format for both publish and subscribe, it MUST
reject the operation with an error code of 4.00 "Bad Request".
There is no default content format. If no ct is specified, the
Broker MUST reject the operation with an error code of 4.00 "Bad
Request".
A Broker MUST return a response code of "2.01 Created" if the topic A Broker MUST return a response code of "2.01 Created" if the topic
is created and return the URI path of the created topic via Location- is created and return the URI path of the created topic via Location-
Path options. The broker MUST return the appropriate 4.xx response Path options. The Broker MUST return the appropriate 4.xx response
code indicating the reason for failure if a new topic can not be code indicating the reason for failure if a new topic can not be
created. Broker SHOULD remove topics if the Max-Age of the topic is created. Broker SHOULD remove topics if the Max-Age of the topic is
exceeded without any publishes to the topic. Broker SHOULD retain a exceeded without any publishes to the topic. Broker SHOULD retain a
topic indefinitely if the Max-Age option is elided or is set to zero topic indefinitely if the Max-Age option is elided or is set to zero
upon topic creation. The lifetime of a topic MUST be refreshed upon upon topic creation. The lifetime of a topic MUST be refreshed upon
create operations with a target of an existing topic. create operations with a target of an existing topic.
Topics may be created as sub-topics of other topics. A client MAY Topic hierarchies can be created by creating parent topics. A parent
create a topic with a ct (Content Format) link attribute value which topic is created with a POST using ct (Content Format) link attribute
describes a supported serialization of the CoRE link format [RFC6690] value which describes a supported serialization of the CoRE link
such as application/link-format (ct=40) or its JSON or CBOR format [RFC6690], such as application/link-format (ct=40) or its JSON
serializations. If a topic is created which describes a link or CBOR serializations. If a topic is created which describes a link
serialization, that topic may then have sub-topics created under it serialization, that topic may then have sub-topics created under it
as shown in Figure 7. as shown in Figure 7.
The CREATE interface is specified as follows: The CREATE interface is specified as follows:
Interaction: Client -> Broker Interaction: Client -> Broker
Method: POST Method: POST
URI Template: {+ps}/{+topic}
URI Template: {+ps}/{+topic}{?q*}
URI Template Variables: ps := Pub/sub REST API entry point URI Template Variables: ps := Pub/sub REST API entry point
(optional). The entry point of the pub/sub REST API, as obtained (optional). The entry point of the pub/sub REST API, as obtained
from discovery, used to discover topics. from discovery, used to discover topics.
topic := The desired topic to return links for (optional). topic := The desired topic to return links for (optional).
q := Query Filter (optional). MAY contain a query filter list as
per [RFC6690] Section 4.1.
Content-Format: application/link-format Content-Format: application/link-format
Payload: The desired topic to CREATE Payload: The desired topic to CREATE
The following response codes are defined for this interface: The following response codes are defined for the CREATE operation:
Success: 2.01 "Created". Successful Creation of the topic Success: 2.01 "Created". Successful Creation of the topic
Failure: 4.00 "Bad Request". Malformed request. Failure: 4.00 "Bad Request". Malformed request.
Failure: 4.01 "Unauthorized". Authorization failure. Failure: 4.01 "Unauthorized". Authorization failure.
Failure: 4.03 "Forbidden". Topic already exists. Failure: 4.03 "Forbidden". Topic already exists.
Failure: 4.06 "Not Acceptable". Unsupported content format for Failure: 4.06 "Not Acceptable". Unsupported content format for
topic. topic.
Figure 6 shows an example of a topic called "topic1" being Figure 6 shows an example of a topic called "topic1" being
successfully created. successfully created.
Client Broker Client Broker
| | | |
| ---------- POST /ps/ "<topic1>;ct=50" -------->| | ---------- POST /ps/ "<topic1>;ct=50" ------->|
| | | |
| <---------------- 2.01 Created ---------------| | <---------------- 2.01 Created ---------------|
| Location: /ps/topic1 | | Location: /ps/topic1 |
| | | |
Figure 6: Example of CREATE topic Figure 6: Example of CREATE topic
Client Broker Client Broker
| | | |
| ------- POST /ps/ "<mainTopic>;ct=40" ------->| | ----- POST /ps/ "<parent-topic>;ct=40" ------>|
| | | |
| <---------------- 2.01 Created ---------------| | <---------------- 2.01 Created ---------------|
| Location: /ps/mainTopic/ | | Location: /ps/parent-topic/ |
| | | |
| --- POST /ps/mainTopic/ "<subTopic>;ct=50" -->| |-- POST /ps/parent-topic/ "<subtopic>;ct=50" ->|
| | | |
| <---------------- 2.01 Created ---------------| | <---------------- 2.01 Created ---------------|
| Location: /ps/mainTopic/subTopic | | Location: /ps/parent-topic/subtopic |
| | | |
| | | |
Figure 7: Example of CREATE sub-topic Figure 7: Example of CREATE of topic hierarchy
4.3. PUBLISH 4.3. PUBLISH
A CoAP pub/sub broker MAY allow clients to PUBLISH to topics on the A CoAP pub/sub Broker MAY allow clients to PUBLISH to topics on the
broker. A client MAY use the PUT or the POST method to publish state Broker. A client MAY use the PUT or the POST method to publish state
updates to the CoAP pub/sub Broker. A client MUST use the content updates to the CoAP pub/sub Broker. A client MUST use the content
format specified upon creation of a given topic to publish updates to format specified upon creation of a given topic to publish updates to
that topic. The broker MUST reject publish operations which do not that topic. The Broker MUST reject publish operations which do not
use the specified content format. A CoAP client publishing on a use the specified content format. A CoAP client publishing on a
topic MAY indicate the maximum lifetime of the value by including the topic MAY indicate the maximum lifetime of the value by including the
Max-Age option in the publish request. The broker MUST return a Max-Age option in the publish request. The Broker MUST return a
response code of "2.04 Changed" if the publish is accepted. A Broker response code of "2.04 Changed" if the publish is accepted. A Broker
MAY return a "4.04 Not Found" if the topic does not exist. A broker MAY return a "4.04 Not Found" if the topic does not exist. A Broker
MAY return "4.29 Too Many Requests" if simple flow control as MAY return "4.29 Too Many Requests" if simple flow control as
described in Section 7 is implemented. described in Section 7 is implemented.
A Broker MUST accept PUBLISH operations using the PUT method. A Broker MUST accept PUBLISH operations using the PUT method.
PUBLISH operations using the PUT method replace any stored PUBLISH operations using the PUT method replace any stored
representation associated with the topic, with the supplied representation associated with the topic, with the supplied
representation. A Broker MAY reject, or delay responses to, PUT representation. A Broker MAY reject, or delay responses to, PUT
requests to a topic while pending resolution of notifications to requests to a topic while pending resolution of notifications to
subscribers from previous PUT requests. subscribers from previous PUT requests.
Create on PUBLISH: A Broker MAY accept PUBLISH operations to new Create on PUBLISH: A Broker MAY accept PUBLISH operations to new
topics using the PUT method. If a Broker accepts a PUBLISH using PUT topics using the PUT method. If a Broker accepts a PUBLISH using PUT
to a topic that does not exist, the Broker MUST create the topic to a topic that does not exist, the Broker MUST create the topic
using the information in the PUT operation. The Broker MUST create a using the information in the PUT operation. The Broker MUST create a
topic with the URI-Path of the request, including all of the sub- topic with the URI-Path of the request, including all of the sub-
topics necessary, and create a topic link with the ct attribute set topics necessary, and create a topic link with the ct attribute set
to the content-format of the payload of the PUT request. If topic is to the content-format value from the header of the PUT request. If
created, the Broker MUST return the response "2.01 Created" with the topic is created, the Broker MUST return the response "2.01 Created"
URI of the created topic, including all of the created path segments, with the URI of the created topic, including all of the created path
returned via the Location-Path option. segments, returned via the Location-Path option.
Figure 9 shows an example of a topic being created on first PUBLISH.
A Broker MAY accept PUBLISH operations using the POST method. If a A Broker MAY accept PUBLISH operations using the POST method. If a
broker accepts PUBLISH using POST it shall respond with the 2.04 Broker accepts PUBLISH using POST it shall respond with the 2.04
Changed status code. Changed status code. If an attempt is made to PUBLISH using POST to
a topic that does not exist, the Broker SHALL return a response
status indicating resource not found, such as HTTP 404 or CoAP 4.04.
A Broker MAY perform garbage collection of stored representations A Broker MAY perform garbage collection of stored representations
which have been delivered to all subscribers or which have timed out. which have been delivered to all subscribers or which have timed out.
A Broker MAY retain at least one most recently published A Broker MAY retain at least one most recently published
representation to return in response to SUBSCRIBE and READ requests. representation to return in response to SUBSCRIBE and READ requests.
A Broker MUST make a best-effort attempt to notify all clients A Broker MUST make a best-effort attempt to notify all clients
subscribed on a particular topic each time it receives a publish on subscribed on a particular topic each time it receives a publish on
that topic. An example is shown in Figure 10. If a client publishes that topic. An example is shown in Figure 10.
to a broker with the Max-Age option, the broker MUST include the same
value for the Max-Age option in all notifications. A broker MUST use
CoAP Notification as described in [RFC7641] to notify subscribed
clients.
The PUBLISH interface is specified as follows: If a client publishes to a Broker with the Max-Age option, the Broker
MUST include the same value for the Max-Age option in all
notifications.
A Broker MUST use CoAP Notification as described in [RFC7641] to
notify subscribed clients.
The PUBLISH operation is specified as follows:
Interaction: Client -> Broker Interaction: Client -> Broker
Method: PUT, POST Method: PUT, POST
URI Template: {+ps}/{+topic}{?q*} URI Template: {+ps}/{+topic}
URI Template Variables: ps := Pub/sub REST API entry point URI Template Variables: ps := Pub/sub REST API entry point
(optional). The entry point of the pub/sub REST API, as obtained (optional). The entry point of the pub/sub REST API, as obtained
from discovery, used to discover topics. from discovery, used to discover topics.
topic := The desired topic to return links for (optional). topic := The desired topic to return links for (optional).
q := Query Filter (optional). MAY contain a query filter list as
per [RFC6690] Section 4.1.
Content-Format: Any valid CoAP content format Content-Format: Any valid CoAP content format
Payload: Representation of the topic value (CoAP resource state Payload: Representation of the topic value (CoAP resource state
representation) in the indicated content format representation) in the indicated content format
The following response codes are defined for this interface: The following response codes are defined for the PUBLISH operation:
Success: 2.01 "Created". Successful publish, topic is created Success: 2.01 "Created". Successful publish, topic is created
Success: 2.04 "Changed". Successful publish, topic is updated Success: 2.04 "Changed". Successful publish, topic is updated
Failure: 4.00 "Bad Request". Malformed request. Failure: 4.00 "Bad Request". Malformed request.
Failure: 4.01 "Unauthorized". Authorization failure. Failure: 4.01 "Unauthorized". Authorization failure.
Failure: 4.04 "Not Found". Topic does not exist. Failure: 4.04 "Not Found". Topic does not exist.
Failure: 4.29 "Too Many Requests". The client should slow down the Failure: 4.29 "Too Many Requests". The client should slow down the
rate of publish messages for this topic (see Section 7). rate of publish messages for this topic (see Section 7).
Figure 8 shows an example of a new value being successfully published Figure 8 shows an example of a new value being successfully published
to the topic "topic1". See Figure 10 for an example of a broker to the topic "topic1". See Figure 10 for an example of a Broker
forwarding a message from a publishing client to a subscribed client. forwarding a message from a publishing client to a subscribed client.
Client Broker Client Broker
| | | |
| ---------- PUT /ps/topic1 "1033.3" --------> | | ---------- PUT /ps/topic1 "1033.3" --------> |
| | | |
| | | |
| <--------------- 2.04 Changed---------------- | | <--------------- 2.04 Changed---------------- |
| | | |
skipping to change at page 13, line 7 skipping to change at page 13, line 45
| | | |
| | | |
| <--------------- 2.01 Created---------------- | | <--------------- 2.01 Created---------------- |
| Location: /ps/exa/mpl/e | | Location: /ps/exa/mpl/e |
| | | |
Figure 9: Example of CREATE on PUBLISH Figure 9: Example of CREATE on PUBLISH
4.4. SUBSCRIBE 4.4. SUBSCRIBE
A CoAP pub/sub broker MAY allow Clients to subscribe to topics on the A CoAP pub/sub Broker MAY allow Clients to subscribe to topics on the
Broker using CoAP Observe as described in [RFC7641]. A CoAP pub/sub Broker using CoAP Observe as described in [RFC7641]. A CoAP pub/sub
Client wishing to Subscribe to a topic on a broker MUST use a CoAP Client wishing to Subscribe to a topic on a Broker MUST use a CoAP
GET with the Observe option set to 0 (zero). The Broker MAY add the GET with the Observe option set to 0 (zero). The Broker MAY add the
client to a list of observers. The Broker MUST return a response client to a list of observers. The Broker MUST return a response
code of "2.05 Content" along with the most recently published value code of "2.05 Content" along with the most recently published value
if the topic contains a valid value and the broker can supply the if the topic contains a valid value and the Broker can supply the
requested content format. The broker MUST reject Subscribe requests requested content format. The Broker MUST reject Subscribe requests
on a topic if the content format of the request is not supported by on a topic if the content format of the request is not the content
the content format the topic was created with. The broker MAY accept format the topic was created with.
Subscribe requests which specify content formats that the broker can
supply as alternate content formats to the content format the topic If the topic was published with the Max-Age option, the Broker MUST
was registered with. If the topic was published with the Max-Age set the Max-Age option in the valid response to the amount of time
option, the broker MUST set the Max-Age option in the valid response remaining for the value to be valid since the last publish operation
to the amount of time remaining for the value to be valid since the on that topic. The Broker MUST return a response code of "2.07 No
last publish operation on that topic. The Broker MUST return a Content" if the topic has not yet been published to, or if Max-Age of
response code of "2.07 No Content" if the Max-Age of the previously the previously stored value has expired. The Broker MUST return a
stored value has expired. The Broker MUST return a response code response code "4.04 Not Found" if the topic does not exist or has
"4.04 Not Found" if the topic does not exist or has been removed. been removed.
The Broker MUST return a response code "4.15 Unsupported Content The Broker MUST return a response code "4.15 Unsupported Content
Format" if it can not return the requested content format. If a Format" if it can not return the requested content format. If a
Broker is unable to accept a new Subscription on a topic, it SHOULD Broker is unable to accept a new Subscription on a topic, it SHOULD
return the appropriate response code without the Observe option as return the appropriate response code without the Observe option as
per as per [RFC7641] Section 4.1. There is no explicit maximum per [RFC7641] Section 4.1.
lifetime of a Subscription, thus a Broker may remove subscribers at
any time. The Broker, upon removing a Subscriber, will transmit the
appropriate response code without the Observe option, as per
[RFC7641] Section 4.2, to the removed Subscriber.
The SUBSCRIBE interface is specified as follows: There is no explicit maximum lifetime of a Subscription, thus a
Broker may remove subscribers at any time. The Broker, upon removing
a Subscriber, will transmit the appropriate response code without the
Observe option, as per [RFC7641] Section 4.2, to the removed
Subscriber.
The SUBSCRIBE operation is specified as follows:
Interaction: Client -> Broker Interaction: Client -> Broker
Method: GET Method: GET
Options: Observe:0 Options: Observe:0
URI Template: {+ps}/{+topic}{?q*} URI Template: {+ps}/{+topic}
URI Template Variables: ps := Pub/sub REST API entry point URI Template Variables: ps := Pub/sub REST API entry point
(optional). The entry point of the pub/sub REST API, as obtained (optional). The entry point of the pub/sub REST API, as obtained
from discovery, used to discover topics. from discovery, used to discover topics.
topic := The desired topic to return links for (optional). topic := The desired topic to return links for (optional).
q := Query Filter (optional). MAY contain a query filter list as The following response codes are defined for the SUBSCRIBE operation:
per [RFC6690] Section 4.1.
The following response codes are defined for this interface:
Success: 2.05 "Content". Successful subscribe, current value Success: 2.05 "Content". Successful subscribe, current value
included included
Success: 2.07 "No Content". Successful subscribe, value not Success: 2.07 "No Content". Successful subscribe, value not
included included
Failure: 4.00 "Bad Request". Malformed request. Failure: 4.00 "Bad Request". Malformed request.
Failure: 4.01 "Unauthorized". Authorization failure. Failure: 4.01 "Unauthorized". Authorization failure.
Failure: 4.04 "Not Found". Topic does not exist. Failure: 4.04 "Not Found". Topic does not exist.
Failure: 4.15 "Unsupported Content Format". Unsupported content Failure: 4.15 "Unsupported Content Format". Unsupported content
format. format.
Figure 10 shows an example of Client2 subscribing to "topic1" and Figure 10 shows an example of Client2 subscribing to "topic1" and
receiving a response from the broker, with a subsequent notification. receiving a response from the Broker, with a subsequent notification.
The subscribe response from the broker uses the last stored value The subscribe response from the Broker uses the last stored value
associated with the topic1. The notification from the broker is sent associated with the topic1. The notification from the Broker is sent
in response to the publish received from Client1. in response to the publish received from Client1.
Client1 Client2 Broker Client1 Client2 Broker
| | Subscribe | | | Subscribe |
| | ----- GET /ps/topic1 Observe:0 Token:XX ----> | | | ----- GET /ps/topic1 Observe:0 Token:XX ----> |
| | | | | |
| | <---------- 2.05 Content Observe:10---------- | | | <---------- 2.05 Content Observe:10---------- |
| | | | | |
| | | | | |
| | Publish | | | Publish |
| ---------|----------- PUT /ps/topic1 "1033.3" --------> | | ---------|----------- PUT /ps/topic1 "1033.3" --------> |
| | Notify | | | Notify |
| | <---------- 2.05 Content Observe:11 --------- | | | <---------- 2.05 Content Observe:11 --------- |
| | | | | |
Figure 10: Example of SUBSCRIBE Figure 10: Example of SUBSCRIBE
4.5. UNSUBSCRIBE 4.5. UNSUBSCRIBE
If a CoAP pub/sub broker allows clients to SUBSCRIBE to topics on the If a CoAP pub/sub Broker allows clients to SUBSCRIBE to topics on the
broker, it MUST allow Clients to unsubscribe from topics on the Broker, it MUST allow Clients to unsubscribe from topics on the
Broker using the CoAP Cancel Observation operation. A CoAP pub/sub Broker using the CoAP Cancel Observation operation. A CoAP pub/sub
Client wishing to unsubscribe to a topic on a Broker MUST either use Client wishing to unsubscribe to a topic on a Broker MUST either use
CoAP GET with Observe using an Observe parameter of 1 or send a CoAP CoAP GET with Observe using an Observe parameter of 1 or send a CoAP
Reset message in response to a publish, as per [RFC7641]. Reset message in response to a publish, as per [RFC7641].
The UNSUBSCRIBE interface is specified as follows: The UNSUBSCRIBE operation is specified as follows:
Interaction: Client -> Broker Interaction: Client -> Broker
Method: GET Method: GET
Options: Observe:1 Options: Observe:1
URI Template: {+ps}/{+topic}{?q*} URI Template: {+ps}/{+topic}{?q*}
URI Template Variables: ps := Pub/sub REST API entry point URI Template Variables: ps := Pub/sub REST API entry point
(optional). The entry point of the pub/sub REST API, as obtained (optional). The entry point of the pub/sub REST API, as obtained
from discovery, used to discover topics. from discovery, used to discover topics.
topic := The desired topic to return links for (optional). topic := The desired topic to return links for (optional).
skipping to change at page 15, line 26 skipping to change at page 16, line 17
URI Template Variables: ps := Pub/sub REST API entry point URI Template Variables: ps := Pub/sub REST API entry point
(optional). The entry point of the pub/sub REST API, as obtained (optional). The entry point of the pub/sub REST API, as obtained
from discovery, used to discover topics. from discovery, used to discover topics.
topic := The desired topic to return links for (optional). topic := The desired topic to return links for (optional).
q := Query Filter (optional). MAY contain a query filter list as q := Query Filter (optional). MAY contain a query filter list as
per [RFC6690] Section 4.1. per [RFC6690] Section 4.1.
The following response codes are defined for this interface: The following response codes are defined for the UNSUBSCRIBE
operation:
Success: 2.05 "Content". Successful unsubscribe, current value Success: 2.05 "Content". Successful unsubscribe, current value
included included
Success: 2.07 "No Content". Successful unsubscribe, value not Success: 2.07 "No Content". Successful unsubscribe, value not
included included
Failure: 4.00 "Bad Request". Malformed request. Failure: 4.00 "Bad Request". Malformed request.
Failure: 4.01 "Unauthorized". Authorization failure. Failure: 4.01 "Unauthorized". Authorization failure.
skipping to change at page 16, line 7 skipping to change at page 16, line 46
| | | |
| ----- GET /ps/topic1 Observe:1 Token:XX ----> | | ----- GET /ps/topic1 Observe:1 Token:XX ----> |
| | | |
| <------------- 2.05 Content ----------------- | | <------------- 2.05 Content ----------------- |
| | | |
Figure 11: Example of UNSUBSCRIBE Figure 11: Example of UNSUBSCRIBE
4.6. READ 4.6. READ
A CoAP pub/sub broker MAY accept Read requests on a topic using the A CoAP pub/sub Broker MAY accept Read requests on a topic using the
the CoAP GET method if the content format of the request matches the the CoAP GET method if the content format of the request matches the
content format the topic was created with. The broker MAY accept content format the topic was created with. The Broker MUST return a
Read requests which specify content formats that the broker can response code of "2.05 Content" along with the most recently
supply as alternate content formats to the content format the topic published value if the topic contains a valid value and the Broker
was registered with. The Broker MUST return a response code of "2.05 can supply the requested content format.
Content" along with the most recently published value if the topic
contains a valid value and the broker can supply the requested
content format. If the topic was published with the Max-Age option,
the broker MUST set the Max-Age option in the valid response to the
amount of time remaining for the topic to be valid since the last
publish. The Broker MUST return a response code of "2.07 No Content"
if the Max-Age of the previously stored value has expired. The
Broker MUST return a response code "4.04 Not Found" if the topic does
not exist or has been removed. The Broker MUST return a response
code "4.15 Unsupported Content Format" if the broker can not return
the requested content format.
The READ interface is specified as follows: If the topic was published with the Max-Age option, the Broker MUST
set the Max-Age option in the valid response to the amount of time
remaining for the topic to be valid since the last publish. The
Broker MUST return a response code of "2.07 No Content" if the Max-
Age of the previously stored value has expired, or if the topic has
not yet been published to.
The Broker MUST return a response code "4.04 Not Found" if the topic
does not exist or has been removed. The Broker MUST return a
response code "4.15 Unsupported Content Format" if the Broker can not
return the requested content format.
The READ operation is specified as follows:
Interaction: Client -> Broker Interaction: Client -> Broker
Method: GET Method: GET
URI Template: {+ps}/{+topic}{?q*} URI Template: {+ps}/{+topic}
URI Template Variables: ps := Pub/sub REST API entry point URI Template Variables: ps := Pub/sub REST API entry point
(optional). The entry point of the pub/sub REST API, as obtained (optional). The entry point of the pub/sub REST API, as obtained
from discovery, used to discover topics. from discovery, used to discover topics.
topic := The desired topic to return links for (optional). topic := The desired topic to return links for (optional).
q := Query Filter (optional). MAY contain a query filter list as The following response codes are defined for the READ operation:
per [RFC6690] Section 4.1.
The following response codes are defined for this interface:
Success: 2.05 "Content". Successful READ, current value included Success: 2.05 "Content". Successful READ, current value included
Success: 2.07 "No Content". Topic exists, value not included Success: 2.07 "No Content". Topic exists, value not included
Failure: 4.00 "Bad Request". Malformed request. Failure: 4.00 "Bad Request". Malformed request.
Failure: 4.01 "Unauthorized". Authorization failure. Failure: 4.01 "Unauthorized". Authorization failure.
Failure: 4.04 "Not Found". Topic does not exist. Failure: 4.04 "Not Found". Topic does not exist.
skipping to change at page 17, line 33 skipping to change at page 18, line 26
| | Read | | | Read |
| | --------------- GET /ps/topic1 -------------> | | | --------------- GET /ps/topic1 -------------> |
| | | | | |
| | <----------- 2.05 Content "1033.3" ---------- | | | <----------- 2.05 Content "1033.3" ---------- |
| | | | | |
Figure 12: Example of READ Figure 12: Example of READ
4.7. REMOVE 4.7. REMOVE
A CoAP pub/sub broker MAY allow clients to remove topics from the A CoAP pub/sub Broker MAY allow clients to remove topics from the
broker using the CoAP Delete method on the URI of the topic. The Broker using the CoAP Delete method on the URI of the topic. The
CoAP pub/sub Broker MUST return "2.02 Deleted" if the removal is CoAP pub/sub Broker MUST return "2.02 Deleted" if the removal is
successful. The broker MUST return the appropriate 4.xx response successful. The Broker MUST return the appropriate 4.xx response
code indicating the reason for failure if the topic can not be code indicating the reason for failure if the topic can not be
removed. When a topic is removed for any reason, the Broker SHOULD removed.
return the response code 4.04 Not Found and remove all of the
observers from the list of observers as per as per [RFC7641]
Section 3.2. If a topic which has sub-topics is removed, then all of
its sub-topics MUST be recursively removed.
The REMOVE interface is specified as follows: When a topic is removed for any reason, the Broker SHOULD remove all
of the observers from the list of observers and return a final 4.04
"Not Found" response as per [RFC7641] Section 3.2. If a topic which
has sub-topics is removed, then all of its sub-topics MUST be
recursively removed.
The REMOVE operation is specified as follows:
Interaction: Client -> Broker Interaction: Client -> Broker
Method: DELETE Method: DELETE
URI Template: {+ps}/{+topic}{?q*} URI Template: {+ps}/{+topic}
URI Template Variables: ps := Pub/sub REST API entry point URI Template Variables: ps := Pub/sub REST API entry point
(optional). The entry point of the pub/sub REST API, as obtained (optional). The entry point of the pub/sub REST API, as obtained
from discovery, used to discover topics. from discovery, used to discover topics.
topic := The desired topic to return links for (optional). topic := The desired topic to return links for (optional).
q := Query Filter (optional). MAY contain a query filter list as
per [RFC6690] Section 4.1.
Content-Format: None Content-Format: None
Response Payload: None Response Payload: None
The following response codes are defined for this interface: The following response codes are defined for the REMOVE operation:
Success: 2.02 "Deleted". Successful remove Success: 2.02 "Deleted". Successful remove
Failure: 4.00 "Bad Request". Malformed request. Failure: 4.00 "Bad Request". Malformed request.
Failure: 4.01 "Unauthorized". Authorization failure. Failure: 4.01 "Unauthorized". Authorization failure.
Failure: 4.04 "Not Found". Topic does not exist. Failure: 4.04 "Not Found". Topic does not exist.
Figure 13 shows a successful remove of topic1. Figure 13 shows a successful remove of topic1.
skipping to change at page 19, line 8 skipping to change at page 19, line 47
A CoAP pub/sub Client may register links [RFC6690] with a Resource A CoAP pub/sub Client may register links [RFC6690] with a Resource
Directory to enable discovery of created pub/sub topics. A pub/sub Directory to enable discovery of created pub/sub topics. A pub/sub
Client may use an RD to discover pub/sub Topics. A client which Client may use an RD to discover pub/sub Topics. A client which
registers pub/sub Topics with an RD MUST use the context relation registers pub/sub Topics with an RD MUST use the context relation
(con) [I-D.ietf-core-resource-directory] to indicate that the context (con) [I-D.ietf-core-resource-directory] to indicate that the context
of the registered links is the pub/sub Broker. of the registered links is the pub/sub Broker.
A CoAP pub/sub Broker may alternatively register links to its topics A CoAP pub/sub Broker may alternatively register links to its topics
to a Resource Directory by triggering the RD to retrieve it's links to a Resource Directory by triggering the RD to retrieve it's links
from .well-known/core. In order to use this method, the links must from .well-known/core. In order to use this method, the links must
first be exposed in the .well-known/core of the pub/sub broker. See first be exposed in the .well-known/core of the pub/sub Broker. See
Section 4.1 in this document. Section 4.1 in this document.
The pub/sub broker triggers the RD to retrieve its links by sending a The pub/sub Broker triggers the RD to retrieve its links by sending a
POST with an empty payload to the .well-known/core of the Resource POST with an empty payload to the .well-known/core of the Resource
Directory. The RD server will then retrieve the links from the Directory. The RD server will then retrieve the links from the
.well-known/core of the pub/sub broker and incorporate them into the .well-known/core of the pub/sub Broker and incorporate them into the
Resource Directory. See [I-D.ietf-core-resource-directory] for Resource Directory. See [I-D.ietf-core-resource-directory] for
further details. further details.
6. Sleep-Wake Operation 6. Sleep-Wake Operation
CoAP pub/sub provides a way for client nodes to sleep between CoAP pub/sub provides a way for client nodes to sleep between
operations, conserving energy during idle periods. This is made operations, conserving energy during idle periods. This is made
possible by shifting the server role to the broker, allowing the possible by shifting the server role to the Broker, allowing the
broker to be always-on and respond to requests from other clients Broker to be always-on and respond to requests from other clients
while a particular client is sleeping. while a particular client is sleeping.
For example, the broker will retain the last state update received For example, the Broker will retain the last state update received
from a sleeping client, in order to supply the most recent state from a sleeping client, in order to supply the most recent state
update to other clients in response to read and subscribe operations. update to other clients in response to read and subscribe operations.
Likewise, the broker will retain the last state update received on Likewise, the Broker will retain the last state update received on
the topic such that a sleeping client, upon waking, can perform a the topic such that a sleeping client, upon waking, can perform a
read operation to the broker to update its own state from the most read operation to the Broker to update its own state from the most
recent system state update. recent system state update.
7. Simple Flow Control 7. Simple Flow Control
Since the broker node has to potentially send a large amount of Since the Broker node has to potentially send a large amount of
notification messages for each publish message and it may be serving notification messages for each publish message and it may be serving
a large amount of subscribers and publishers simultaneously, the a large amount of subscribers and publishers simultaneously, the
broker may become overwhelmed if it receives many publish messages to Broker may become overwhelmed if it receives many publish messages to
popular topics in a short period of time. popular topics in a short period of time.
If the broker is unable to serve a certain client that is sending If the Broker is unable to serve a certain client that is sending
publish messages too fast, the broker SHOULD respond with Response publish messages too fast, the Broker SHOULD respond with Response
Code 4.29, "Too Many Requests" [I-D.keranen-core-too-many-reqs] and Code 4.29, "Too Many Requests" [I-D.keranen-core-too-many-reqs] and
set the Max-Age Option to indicate the number of seconds after which set the Max-Age Option to indicate the number of seconds after which
the client can retry. The broker MAY stop creating notifications the client can retry. The Broker MAY stop creating notifications
from the publish messages from this client and to this topic for the from the publish messages from this client and to this topic for the
indicated time. indicated time.
If a client receives the 4.29 Response Code from the broker for a If a client receives the 4.29 Response Code from the Broker for a
publish message to a topic, it MUST NOT send new publish messages to publish message to a topic, it MUST NOT send new publish messages to
the broker on the same topic before the time indicated in Max-Age has the Broker on the same topic before the time indicated in Max-Age has
passed. passed.
8. Security Considerations 8. Security Considerations
CoAP pub/sub re-uses CoAP [RFC7252], CoRE Resource Directory CoAP pub/sub re-uses CoAP [RFC7252], CoRE Resource Directory
[I-D.ietf-core-resource-directory], and Web Linking [RFC5988] and [I-D.ietf-core-resource-directory], and Web Linking [RFC5988] and
therefore the security considerations of those documents also apply therefore the security considerations of those documents also apply
to this specification. Additionally, a CoAP pub/sub broker and the to this specification. Additionally, a CoAP pub/sub Broker and the
clients SHOULD authenticate each other and enforce access control clients SHOULD authenticate each other and enforce access control
policies. A malicious client could subscribe to data it is not policies. A malicious client could subscribe to data it is not
authorized to or mount a denial of service attack against the broker authorized to or mount a denial of service attack against the Broker
by publishing a large number of resources. The authentication can be by publishing a large number of resources. The authentication can be
performed using the already standardized DTLS offered mechanisms, performed using the already standardized DTLS offered mechanisms,
such as certificates. DTLS also allows communication security to be such as certificates. DTLS also allows communication security to be
established to ensure integrity and confidentiality protection of the established to ensure integrity and confidentiality protection of the
data exchanged between these relevant parties. Provisioning the data exchanged between these relevant parties. Provisioning the
necessary credentials, trust anchors and authorization policies is necessary credentials, trust anchors and authorization policies is
non-trivial and subject of ongoing work. non-trivial and subject of ongoing work.
The use of a CoAP pub/sub broker introduces challenges for the use of The use of a CoAP pub/sub Broker introduces challenges for the use of
end-to-end security between for example a client device on a sensor end-to-end security between for example a client device on a sensor
network and a client application running in a cloud-based server network and a client application running in a cloud-based server
infrastructure since brokers terminate the exchange. While running infrastructure since Brokers terminate the exchange. While running
separate DTLS sessions from the client device to the broker and from separate DTLS sessions from the client device to the Broker and from
broker to client application protects confidentially on those paths, Broker to client application protects confidentially on those paths,
the client device does not know whether the commands coming from the the client device does not know whether the commands coming from the
broker are actually coming from the client application. Similarly, a Broker are actually coming from the client application. Similarly, a
client application requesting data does not know whether the data client application requesting data does not know whether the data
originated on the client device. For scenarios where end-to-end originated on the client device. For scenarios where end-to-end
security is desirable the use of application layer security is security is desirable the use of application layer security is
unavoidable. Application layer security would then provide a unavoidable. Application layer security would then provide a
guarantee to the client device that any request originated at the guarantee to the client device that any request originated at the
client application. Similarly, integrity protected sensor data from client application. Similarly, integrity protected sensor data from
a client device will also provide guarantee to the client application a client device will also provide guarantee to the client application
that the data originated on the client device itself. The protected that the data originated on the client device itself. The protected
data can also be verified by the intermediate broker ensuring that it data can also be verified by the intermediate Broker ensuring that it
stores/caches correct request/response and no malicious messages/ stores/caches correct request/response and no malicious messages/
requests are accepted. The broker would still be able to perform requests are accepted. The Broker would still be able to perform
aggregation of data/requests collected. aggregation of data/requests collected.
Depending on the level of trust users and system designers place in Depending on the level of trust users and system designers place in
the CoAP pub/sub broker, the use of end-to-end object security is the CoAP pub/sub Broker, the use of end-to-end object security is
RECOMMENDED as described in [I-D.palombini-ace-coap-pubsub-profile]. RECOMMENDED as described in [I-D.palombini-ace-coap-pubsub-profile].
When only end-to-end encryption is necessary and the CoAP Broker is When only end-to-end encryption is necessary and the CoAP Broker is
trusted, Payload Only Protection (Mode:PAYL) could be used. The trusted, Payload Only Protection (Mode:PAYL) could be used. The
Publisher would wrap only the payload before sending it to the broker Publisher would wrap only the payload before sending it to the Broker
and set the option Content-Format to application/smpayl. Upon and set the option Content-Format to application/smpayl. Upon
receival, the Broker can read the unencrypted CoAP header to forward receival, the Broker can read the unencrypted CoAP header to forward
it to the subscribers. it to the subscribers.
9. IANA Considerations 9. IANA Considerations
This document registers one attribute value in the Resource Type This document registers one attribute value in the Resource Type
(rt=) registry established with [RFC6690] and appends to the (rt=) registry established with [RFC6690] and appends to the
definition of one CoAP Response Code in the CoRE Parameters Registry. definition of one CoAP Response Code in the CoRE Parameters Registry.
skipping to change at page 22, line 12 skipping to change at page 22, line 52
Selander, Mikko Majanen, and Olaf Bergmann for their contributions Selander, Mikko Majanen, and Olaf Bergmann for their contributions
and reviews. and reviews.
11. References 11. References
11.1. Normative References 11.1. Normative References
[I-D.keranen-core-too-many-reqs] [I-D.keranen-core-too-many-reqs]
Keranen, A., "Too Many Requests Response Code for the Keranen, A., "Too Many Requests Response Code for the
Constrained Application Protocol", draft-keranen-core-too- Constrained Application Protocol", draft-keranen-core-too-
many-reqs-00 (work in progress), March 2018. many-reqs-01 (work in progress), March 2018.
[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
Requirement Levels", BCP 14, RFC 2119, DOI 10.17487/ Requirement Levels", BCP 14, RFC 2119,
RFC2119, March 1997, <https://www.rfc-editor.org/info/ DOI 10.17487/RFC2119, March 1997, <https://www.rfc-
rfc2119>. editor.org/info/rfc2119>.
[RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform
Resource Identifier (URI): Generic Syntax", STD 66, RFC Resource Identifier (URI): Generic Syntax", STD 66,
3986, DOI 10.17487/RFC3986, January 2005, RFC 3986, DOI 10.17487/RFC3986, January 2005,
<https://www.rfc-editor.org/info/rfc3986>. <https://www.rfc-editor.org/info/rfc3986>.
[RFC6570] Gregorio, J., Fielding, R., Hadley, M., Nottingham, M., [RFC6570] Gregorio, J., Fielding, R., Hadley, M., Nottingham, M.,
and D. Orchard, "URI Template", RFC 6570, DOI 10.17487/ and D. Orchard, "URI Template", RFC 6570,
RFC6570, March 2012, <https://www.rfc-editor.org/info/ DOI 10.17487/RFC6570, March 2012, <https://www.rfc-
rfc6570>. editor.org/info/rfc6570>.
[RFC6690] Shelby, Z., "Constrained RESTful Environments (CoRE) Link [RFC6690] Shelby, Z., "Constrained RESTful Environments (CoRE) Link
Format", RFC 6690, DOI 10.17487/RFC6690, August 2012, Format", RFC 6690, DOI 10.17487/RFC6690, August 2012,
<https://www.rfc-editor.org/info/rfc6690>. <https://www.rfc-editor.org/info/rfc6690>.
[RFC7252] Shelby, Z., Hartke, K., and C. Bormann, "The Constrained [RFC7252] Shelby, Z., Hartke, K., and C. Bormann, "The Constrained
Application Protocol (CoAP)", RFC 7252, DOI 10.17487/ Application Protocol (CoAP)", RFC 7252,
RFC7252, June 2014, <https://www.rfc-editor.org/info/ DOI 10.17487/RFC7252, June 2014, <https://www.rfc-
rfc7252>. editor.org/info/rfc7252>.
[RFC7641] Hartke, K., "Observing Resources in the Constrained [RFC7641] Hartke, K., "Observing Resources in the Constrained
Application Protocol (CoAP)", RFC 7641, DOI 10.17487/ Application Protocol (CoAP)", RFC 7641,
RFC7641, September 2015, <https://www.rfc-editor.org/info/ DOI 10.17487/RFC7641, September 2015, <https://www.rfc-
rfc7641>. editor.org/info/rfc7641>.
11.2. Informative References 11.2. Informative References
[I-D.ietf-core-object-security] [I-D.ietf-core-object-security]
Selander, G., Mattsson, J., Palombini, F., and L. Seitz, Selander, G., Mattsson, J., Palombini, F., and L. Seitz,
"Object Security for Constrained RESTful Environments "Object Security for Constrained RESTful Environments
(OSCORE)", draft-ietf-core-object-security-09 (work in (OSCORE)", draft-ietf-core-object-security-13 (work in
progress), March 2018. progress), June 2018.
[I-D.ietf-core-resource-directory] [I-D.ietf-core-resource-directory]
Shelby, Z., Koster, M., Bormann, C., Stok, P., and C. Shelby, Z., Koster, M., Bormann, C., Stok, P., and C.
Amsuess, "CoRE Resource Directory", draft-ietf-core- Amsuess, "CoRE Resource Directory", draft-ietf-core-
resource-directory-13 (work in progress), March 2018. resource-directory-14 (work in progress), July 2018.
[I-D.palombini-ace-coap-pubsub-profile] [I-D.palombini-ace-coap-pubsub-profile]
Palombini, F., "CoAP Pub-Sub Profile for Authentication Palombini, F., "CoAP Pub-Sub Profile for Authentication
and Authorization for Constrained Environments (ACE)", and Authorization for Constrained Environments (ACE)",
draft-palombini-ace-coap-pubsub-profile-02 (work in draft-palombini-ace-coap-pubsub-profile-03 (work in
progress), March 2018. progress), June 2018.
[RFC5988] Nottingham, M., "Web Linking", RFC 5988, DOI 10.17487/ [RFC5988] Nottingham, M., "Web Linking", RFC 5988,
RFC5988, October 2010, <https://www.rfc-editor.org/info/ DOI 10.17487/RFC5988, October 2010, <https://www.rfc-
rfc5988>. editor.org/info/rfc5988>.
Authors' Addresses Authors' Addresses
Michael Koster Michael Koster
SmartThings SmartThings
Email: Michael.Koster@smartthings.com Email: Michael.Koster@smartthings.com
Ari Keranen Ari Keranen
Ericsson Ericsson
 End of changes. 115 change blocks. 
225 lines changed or deleted 257 lines changed or added

This html diff was produced by rfcdiff 1.47. The latest version is available from http://tools.ietf.org/tools/rfcdiff/