[riot-notifications] [RIOT-OS/RIOT] gcoap: Add 'observable' option to resources (#11587)

Ken Bannister notifications at github.com
Mon Sep 9 01:13:06 CEST 2019

It's been too long since I read RFC 7641. I agree that an app can find it useful to specify if a resource is observable. At the same time, to allow for minimal resource use, I would rather not *require* that the app does so.

At least for now, I suggest allowing this specification to be defined solely by the application. So, I see that they have two choices. Let's use the gcoap example app.

1. Add the 'obs' attribute to the `_link_params` array for a particular resource. This is the simplest solution.

2. Add a locally defined constant to the coap_resource_t `methods` attribute. This attribute might be like COAP_OBSERVABLE or COAP_NOT_OBSERVABLE depending on what makes the most sense as a default. Then in `_encode_link()`, append the 'obs' link attribute based on the value in 'methods'.

Neither of these solutions have the advantage of enforcing this property of observability in `_handle_req()`, as in this PR. In other words, a client could still set up an observation for a resource that won't generation notifications. But really in this case there is a breakdown. The server has publicized its API via `/.well-known/core` or a resource directory. However, the client is making a request that the server has declared is not valid.

As you and I have discussed, we would like to see a more featureful application framework that can support the level of functionality in this PR. I just don't think we're there yet.

If you agree, then I think it would be worthwhile to create an alternate PR with two elements: Add 'obs' to the _link_params array for `/cli/stats` in the gcoap example. Also add a sentence or two to the Observe Server section of the module documentation to remind the reader of the 'obs' hint. Since I'm the troublemaker, I'd be glad to write it if you'll review it. :-)

You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190908/386042b2/attachment-0001.htm>

More information about the notifications mailing list