Skip to content

Commit c3bf77a

Browse files
authored
Merge pull request #61 from EskoDijk/pr-optim-attributes
Optimize use of rt,ct,obs attributes
2 parents b5d6d8a + 92f1f59 commit c3bf77a

File tree

1 file changed

+28
-13
lines changed

1 file changed

+28
-13
lines changed

draft-ietf-core-coap-pubsub.md

+28-13
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ Topic-data interactions are publish, subscribe, unsubscribe, read, and delete. T
163163
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".
166+
Other child resource types are currently not defined for a topic collection resource.
166167

167168
# PubSub Topics {#topics}
168169

@@ -198,7 +199,7 @@ Publication and subscription to a topic occur at a link, where the link target i
198199

199200
A topic resource with a topic-data link can also be simply called "topic".
200201

201-
The list of links to the topic resources can be retrieved from the associated topic collection resource, and represented as a Link Format document {{RFC6690}}where each such link specifies the link target attribute 'rt' (Resource Type), with value "core.ps.conf" defined in this document.
202+
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.
202203

203204
## Topic Representation {#topic-resource-representation}
204205

@@ -235,10 +236,11 @@ The CBOR map includes the following configuration parameters, whose CBOR abbrevi
235236
## Discovery
236237

237238
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.
239+
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.
238240

239241
### Broker Discovery {#broker-discovery}
240242

241-
CoAP clients MAY discover brokers by using CoAP Simple 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.
243+
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.
242244

243245
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.
244246

@@ -282,15 +284,19 @@ Example:
282284
Header: Content (Code=2.05)
283285
Content-Format: 40 (application/link-format)
284286
Payload:
285-
</ps>;rt="core.ps.coll";ct=40,
286-
</other/path>;rt="core.ps.coll";ct=40
287+
</ps>;rt="core.ps.coll",
288+
</other/path>;rt="core.ps.coll"
287289
~~~~
288290

291+
Note that the "ct" attribute is not included for the two collections in the returned link format document.
292+
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").
293+
294+
289295
### Topic Discovery {#topic-discovery}
290296

291297
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".
292298

293-
Below is an example of discovery via /.well-known/core with rt=core.ps.conf that returns a list of topics, as the list of links to the corresponding topic resources.
299+
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.
294300

295301

296302
~~~~
@@ -306,18 +312,19 @@ Below is an example of discovery via /.well-known/core with rt=core.ps.conf that
306312
Header: Content (Code=2.05)
307313
Content-Format: 40 (application/link-format)
308314
Payload:
309-
</ps/h9392>;rt="core.ps.conf";ct=TBD606,
310-
</other/path/2e3570>;rt="core.ps.conf";ct=TBD606
315+
</ps/h9392>;rt="core.ps.conf",
316+
</other/path/2e3570>;rt="core.ps.conf"
311317
~~~~
312318

313319
### Topic-Data Discovery
314320

315321

316322
Within a topic, there is the topic-data property containing the URI of the topic-data resource that a CoAP client can subscribe and publish to. Resources exposing resources of the topic-data type are expected to use the resource type 'core.ps.data'.
317323

318-
The topic-data 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}}).
324+
The topic-data key in the topic resource 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}}).
319325

320-
It is also possible to discover a list of topic-data resources by sending a request to the collection with rt=core.ps.data resources as shown below.
326+
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.
327+
Any topic collection resource MUST support this query.
321328

322329
~~~~
323330
Request:
@@ -331,9 +338,12 @@ It is also possible to discover a list of topic-data resources by sending a requ
331338
Header: Content (Code=2.05)
332339
Content-Format: 40 (application/link-format)
333340
Payload:
334-
</ps/data/62e4f8d>;rt="core.ps.data";obs
341+
</ps/data/62e4f8d>
335342
~~~~
336343

344+
Note that the "rt" attribute is not included in the returned link in the example response.
345+
This is because the query in the request already constrains all links in the response to be only of type "core.ps.data".
346+
337347
## Topic Collection Interactions {#topic-collection-interactions}
338348

339349
These are the interactions that can happen directly with a specific topic collection.
@@ -345,6 +355,10 @@ A client can request a collection of the topics present in the broker by making
345355
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}}).
346356

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

349363
Example:
350364

@@ -359,8 +373,7 @@ Example:
359373
Header: Content (Code=2.05)
360374
Content-Format: 40 (application/link-format)
361375
Payload:
362-
</ps/h9392>;rt="core.ps.conf",
363-
</ps/2e3570>;rt="core.ps.conf"
376+
</ps/h9392>,</ps/2e3570>
364377
~~~~
365378

366379
### Getting topics by Properties {#topic-get-properties}
@@ -394,9 +407,11 @@ Example:
394407
Header: Content (Code=2.05)
395408
Content-Format: 40 (application/link-format)
396409
Payload:
397-
</ps/2e3570>;rt="core.ps.conf"
410+
</ps/2e3570>
398411
~~~~
399412

413+
Note that no "rt" or "ct" attributes are returned in the link format document, since the type of each link
414+
(topic resource with rt="core.ps.conf") is implied as the default resource type of each topic resource by this specification.
400415

401416
### Creating a Topic {#topic-create}
402417

0 commit comments

Comments
 (0)