Skip to content

Commit d1ff90e

Browse files
authored
Merge pull request #68 from EskoDijk/pr-optim-attributes-2
Explain better optimization of attributes; broker MAY include any attribute
2 parents 792c643 + 0f395ab commit d1ff90e

File tree

1 file changed

+38
-29
lines changed

1 file changed

+38
-29
lines changed

draft-ietf-core-coap-pubsub.md

+38-29
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ One important class of constrained devices includes devices that are intended to
7878

7979
For these nodes, the client/server-oriented architecture of REST can be challenging when interactions are not initiated by the devices themselves. A publish/subscribe-oriented architecture where nodes exchange data via topics through a broker entity might fit these nodes better.
8080

81-
This document applies the idea of broker-based publish-subscribe to Constrained RESTful Environments using CoAP. It defines a broker that allows to create, discover subscribe and publish on topics.
81+
This document applies the idea of broker-based publish-subscribe to Constrained RESTful Environments using CoAP. It defines a broker that allows to create, discover, subscribe and publish on topics.
8282

8383
## Terminology {#terminology}
8484

@@ -99,7 +99,7 @@ topic collection:
9999
: A set of topics. A topic collection is hosted as one collection resource (See {{Section 3.1 of I-D.ietf-core-interfaces}}) at the broker, and its representation is the list of links to the topic resources corresponding to each topic.
100100

101101
topic:
102-
: A set of information concerning a topic, including its configuration and other metadata. A topic is hosted as one topic resource at the broker, and its representation is the set of topic properties concerning the topic. All the topic resources associated with the same topic collection share a common base URI, i.e., the URI of the collection resource.
102+
: A set of information concerning a topic, including its configuration and other metadata. A topic is hosted as one topic resource at the broker, and its representation is the set of topic properties concerning the topic. All the topic resources associated with the same topic collection share a common base URI, i.e., the URI of the topic collection resource.
103103

104104
topic property:
105105
: A single element of configuration information that is associated to a topic.
@@ -146,7 +146,7 @@ Topic-data interactions are publish, subscribe, unsubscribe, read, and delete. T
146146

147147
## Managing Topics {#managing-topics}
148148

149-
{{fig-api}} shows the resources related to a topic collection that can be managed at the Broker.
149+
{{fig-api}} shows the resources related to a topic collection that can be managed at the broker.
150150

151151
~~~~ aasvg
152152
___
@@ -160,7 +160,7 @@ Topic-data interactions are publish, subscribe, unsubscribe, read, and delete. T
160160
~~~~
161161
{: #fig-api title="Resources of a Broker" artwork-align="center"}
162162

163-
The Broker exports one or more topic collection resources, with resource type "core.ps.coll" defined in {{iana}} of this document. The interfaces for the topic collection resource is defined in {{topic-collection-interactions}}.
163+
The broker exports one or more topic collection resources, with resource type "core.ps.coll" defined in {{iana}} of this document. The interfaces for the topic collection resource is defined in {{topic-collection-interactions}}.
164164

165165
A topic collection resource can have topic resources as its child resources, with resource type "core.ps.conf". Other child resource types are currently not defined for a topic collection resource.
166166

@@ -194,11 +194,11 @@ The configuration side of a publish and subscribe broker consists of a collectio
194194

195195
Each topic is represented as a link, where the link target is the URI of the corresponding topic resource.
196196

197-
Publication and subscription to a topic occur at a link, where the link target is the URI of the corresponding topic-data resource. Such a link is specified by the topic-data entry within the topic resource (see {{topic-properties}}).
197+
Publication and subscription to a topic occur at a link, where the link target is the URI of the corresponding topic-data resource. Such a link is specified by the "topic-data" topic property within the topic resource (see {{topic-properties}}).
198198

199199
A topic resource with a topic-data link can also be simply called "topic".
200200

201-
The list of links to the topic resources can be retrieved from the associated topic collection resource, represented as a Link Format document {{RFC6690}} where each link is a topic resource of type "core.ps.conf" as defined in this document.
201+
The list of links to the topic resources can be retrieved from the associated topic collection resource, represented as a CoRE Link Format document {{RFC6690}} where each link is a topic resource of type "core.ps.conf" as defined in this document.
202202

203203
## Topic Representation {#topic-resource-representation}
204204

@@ -237,9 +237,14 @@ The CBOR map includes the following topic properties, whose CBOR abbreviations a
237237
A client can perform a discovery of: the broker; the topic collection resources and topic resources hosted by the broker; and the topic-data resources associated with those topic resources.
238238
Any server implementing a pubsub broker MUST support CoAP discovery with a query parameter as defined in {{Section 4.1 of RFC6690}} and as used in the examples in this section.
239239

240+
The CoRE Link Format discovery responses shown in the examples in this section are illustrative only.
241+
The normative requirements for this format are defined in {{RFC6690}}.
242+
The examples make minimal use of CoRE Link Format attributes, in order to reduce the size of discovery responses: this is beneficial for clients connected to constrained networks.
243+
In general, a broker MAY include any CoRE Link Format attributes in each returned link, for example to meet specific use case requirements.
244+
240245
### Broker Discovery {#broker-discovery}
241246

242-
CoAP clients MAY discover brokers by using CoAP discovery, via multicast, through a Resource Directory (RD) {{RFC9176}} or by other means specified in extensions to {{RFC7252}}. Brokers MAY register with a RD by following the steps on {{Section 5 of RFC9176}} with the resource type set to "core.ps" as defined in {{iana}} of this document.
247+
CoAP clients MAY discover brokers by using CoAP discovery {{RFC7252}}, via multicast, through a Resource Directory (RD) {{RFC9176}} or by other means specified in extensions to {{RFC7252}}. Brokers MAY register with a RD by following the steps on {{Section 5 of RFC9176}} with the resource type set to "core.ps" as defined in {{iana}} of this document.
243248

244249
The following example shows an endpoint discovering a broker using the "core.ps" resource type over a multicast network. Brokers within the multicast scope will answer the query.
245250

@@ -262,11 +267,11 @@ The following example shows an endpoint discovering a broker using the "core.ps"
262267

263268
### Topic Collection Discovery
264269

265-
A Broker SHOULD offer a topic discovery entry point to enable clients to find topics of interest. The resource entry point is the topic collection resource collecting the topics for those topics (see {{Section 1.2.2 of RFC6690}}) and is identified by the resource type "core.ps.coll".
270+
A broker SHOULD offer a topic discovery entry point to enable clients to find topics of interest. The resource entry point is the topic collection resource collecting the topics for those topics (see {{Section 1.2.2 of RFC6690}}) and is identified by the resource type "core.ps.coll".
266271

267272
The specific resource path is left for implementations, examples in this document use the "/ps" path. The interactions with a topic collection are further defined in {{topic-collection-interactions}}.
268273

269-
Since the representation of the topic collection resource includes the links to the associated topic resources, it is not required to locate those links under "/.well-known/core", also in order to limit the size of the Link Format document returned as result of the discovery.
274+
Since the representation of the topic collection resource includes the links to the associated topic resources, it is not required to locate those links under "/.well-known/core", also in order to limit the size of the CoRE Link Format document returned as result of the discovery.
270275

271276
Example:
272277

@@ -287,17 +292,15 @@ Example:
287292
</other/path>;rt="core.ps.coll"
288293
~~~~
289294

290-
Note that the "ct" attribute is not included for the two collections in the returned link format document.
291-
This is because the content-format of each topic collection resource is implied by its resource type (rt="core.ps.coll") to be 40 ("application/link-format").
292-
295+
Note that in this example the "ct" attribute is not included for the two collections in the returned CoRE Link Format document.
296+
This is because the "ct" attribute is an optional hint, which is not needed in this case: the content-format of each topic collection resource is implied by its resource type (rt="core.ps.coll") to be 40 ("application/link-format").
293297

294298
### Topic Discovery {#topic-discovery}
295299

296300
Each topic collection is associated with a group of topic resources, each detailing the configuration of its respective topic (refer to {{topic-properties}}). Each topic resource is identified by the resource type "core.ps.conf".
297301

298302
Below is an example of discovery via /.well-known/core with query rt=core.ps.conf that returns a list of topics, as the list of links to the corresponding topic resources.
299303

300-
301304
~~~~
302305
Request:
303306

@@ -317,14 +320,12 @@ Below is an example of discovery via /.well-known/core with query rt=core.ps.con
317320

318321
### Topic-Data Discovery
319322

320-
321323
Within a topic, there is the 'topic-data' topic property containing the URI of the topic-data resource that a CoAP client can subscribe to and/or publish to.
322-
Topic-data resources are expected to use the resource type 'core.ps.data'.
324+
Topic-data resources use the resource type 'core.ps.data'.
323325

326+
The "topic-data" topic property value contains the URI of the topic-data resource for publishing and subscribing. So retrieving the topic will also provide the URL of the topic-data resource (see {{topic-get-resource}}).
324327

325-
The "topic-data" property value contains the URI of the topic-data resource for publishing and subscribing. So retrieving the topic will also provide the URL of the topic-data (see {{topic-get-resource}}).
326-
327-
It is also possible to discover a list of topic-data resources by sending a request to the collection with query rt=core.ps.data resources as shown below.
328+
It is also possible to discover a list of topic-data resources by sending a request to the collection with a query rt=core.ps.data as shown below.
328329
Any topic collection resource MUST support this query.
329330

330331
~~~~
@@ -344,22 +345,26 @@ Any topic collection resource MUST support this query.
344345

345346
Note that the "rt" attribute is not included in the returned link in the example response.
346347
This is because the query in the request already constrains all links in the response to be only of type "core.ps.data".
348+
Therefore, including the "rt" attribute for each returned link would be unnecessary and would make the response size much larger.
349+
So the broker, in this example case, was implemented to elide these attributes always, to minimize the size of discovery response payloads.
347350

348351
## Topic Collection Interactions {#topic-collection-interactions}
349352

350-
These are the interactions that can happen directly with a specific topic collection.
353+
Topic collection interactions are the interactions that can happen directly with a specific topic collection.
354+
355+
The CoRE Link Format responses shown in the examples in this section are illustrative only.
356+
The normative requirements for this format are defined in {{RFC6690}}.
357+
The examples make minimal use of CoRE Link Format attributes, in order to reduce the size of responses: this is beneficial for clients connected to constrained networks.
358+
In general, a broker MAY include any CoRE Link Format attributes in each returned link, for example to meet specific use case requirements.
351359

352360
### Retrieving all topics {#topic-get-all}
353361

354-
A client can request a collection of the topics present in the broker by making a GET request to the collection URI.
362+
A client can request a collection of the topics present in the broker by making a GET request to the topic collection URI.
355363

356364
On success, the broker returns a 2.05 (Content) response, specifying the list of links to topic resources associated with this topic collection (see {{topic-resource-representation}}).
357365

358366
A client MAY retrieve a list of links to topics it is authorized to access, based on its permissions.
359-
The payload content-format 40 ("application/link-format") MUST be at least supported for the collection resource.
360-
Note that no "rt" or "ct" attributes are returned for the topic resources in the example payload, because
361-
the resource type (rt="core.ps.conf") is already implied by this specification for the topic collection and
362-
the content-format (TBD606) is implied by the resource type.
367+
The payload content-format 40 ("application/link-format") MUST be at least supported for the topic collection resource.
363368

364369
Example:
365370

@@ -377,10 +382,14 @@ Example:
377382
</ps/h9392>,</ps/2e3570>
378383
~~~~
379384

385+
Note that no "rt" or "ct" attributes are returned for the topic resources in the example payload, because
386+
the resource type (rt="core.ps.conf") is already implied by this specification for the topic collection and
387+
the content-format (TBD606) is implied by the resource type.
388+
380389
### Getting Topics by Topic Properties {#topic-get-properties}
381390

382391
A client can filter a collection of topics by submitting the representation of a topic filter (see {{topic-fetch-resource}}) in a FETCH request to the topic collection URI.
383-
On success, the broker returns a 2.05 (Content) response with a representation of a list of topics in the collection (see {{topic-discovery}}) that match the filter in CoRE link format {{RFC6690}}.
392+
On success, the broker returns a 2.05 (Content) response with a representation of a list of topics in the collection (see {{topic-discovery}}) that match the filter in CoRE Link Format {{RFC6690}}.
384393

385394
Upon success, the broker responds with a 2.05 (Content), providing a list of links to topic resources associated with this topic collection that match the request's filter criteria (refer to {{topic-discovery}}). A positive match happens only when each topic property in the request payload is present with the indicated value in the topic resource representation.
386395

@@ -407,8 +416,9 @@ Example:
407416
</ps/2e3570>
408417
~~~~
409418

410-
Note that no "rt" or "ct" attributes are returned in the link format document, since the type of each link
419+
Note that in this example no "rt" or "ct" attributes are returned in the response payload, since the type of each link
411420
(topic resource with rt="core.ps.conf") is implied as the default resource type of each topic resource by this specification.
421+
Eliding these attributes helps to minimize the size of the response payload.
412422

413423
### Creating a Topic {#topic-create}
414424

@@ -449,7 +459,6 @@ The broker MUST issue a 4.00 (Bad Request) error if a received parameter is inva
449459
/ topic-name / 0: "living-room-sensor",
450460
/ topic-data / 1: "ps/data/1bd0d6d",
451461
/ resource-type / 2: "core.ps.data"
452-
453462
}
454463
~~~~
455464

@@ -467,7 +476,7 @@ If requirements are defined for the client to read the topic as requested and th
467476

468477
The response payload is a CBOR map, whose possible entries are specified in {{topic-resource-representation}} and use the same abbreviations defined in {{pubsub-parameters}}.
469478

470-
For example, below is a request on the topic "ps/h9392":
479+
For example, below is a request on the topic "/ps/h9392":
471480

472481
~~~~
473482
Request:
@@ -909,7 +918,7 @@ Note that the media type application/core-pubsub+cbor MUST be used when these to
909918

910919
# Security Considerations {#seccons}
911920

912-
The architecture presented in this document inherits the security considerations from CoAP {{RFC7252}} and Observe {{RFC7641}}, as well as from Web Linking {{RFC8288}}, Link-Format {{RFC6690}}, and the CoRE Resource Directory {{RFC9176}}.
921+
The architecture presented in this document inherits the security considerations from CoAP {{RFC7252}} and Observe {{RFC7641}}, as well as from Web Linking {{RFC8288}}, CoRE Link Format {{RFC6690}}, and the CoRE Resource Directory {{RFC9176}}.
913922

914923
Communications between each client and the broker are RECOMMENDED to be secured, e.g., by using OSCORE {{RFC8613}} or DTLS {{RFC9147}}. Security considerations for the used secure communication protocols apply too.
915924

0 commit comments

Comments
 (0)