Subject: [core] More precision about CoAP Observe with FETCH

From: Simon Bernard <[email-masked]>
Date: Tue, 29 Jun 2021 11:18:36 +0200

Hi all,

The PATCH and FETCH Methods for the Constrained Application
Protocol (CoAP) (RFC8132)
says that FETCH can be used with RFC7641
(Observing Resources in CoAP)

2.4. Working with Observe

The Observe option [RFC7641] can be used with a FETCH request as it
can be used with a GET request

But "CoAP Observe" seems to be designed with a "GET without
payload" in mind.

E.g. it says :

3.1. Request

A client registers its interest in a resource by issuing a GET
request with an Observe Option set to 0 (register). If the server
returns a 2.xx response that includes an Observe Option as well, the
server has successfully added an entry with the client endpoint and
request token to the list of observers of the target resource, and
the client will be notified of changes to the resource state.

Like a fresh response can be used to satisfy a request without
contacting the server, the stream of updates resulting from one
observation request can be used to satisfy another (observation or
normal GET) request if the target resource is the same. A client
MUST aggregate such requests and MUST NOT register more than once for
the same target resource. The target resource is identified by all
options in the request that are part of the Cache-Key. This includes,
for example, the full request URI and the Accept Option.

The target resource is not identified by the payload.  So 2 FETCH
requests on same resource with 2 different payload seem to not be
allowed ?

Is it intended or just an oversight ? if this is intended, is
there any particular reason about this ?

Simon

---

From: "Jon Shallow" <[email-masked]>
Date: Tue, 29 Jun 2021 10:45:54 +0100

Hi Simon,

As per https://datatracker.ietf.org/doc/html/rfc8132#section-2 the FEETCH request body is a part of the cache key.

   Depending on the response code as defined by [RFC7252 <https://datatracker.ietf.org/doc/html/rfc7252> ], the response

   to a FETCH request is cacheable; the request body is part of the

   cache key.  Specifically, 2.05 (Content) response codes (the

   responses for which are cacheable) are a typical way to respond to a

   FETCH request.  (Note that this aspect differs markedly from

   [HTTP-SEARCH <https://datatracker.ietf.org/doc/html/rfc8132#ref-HTTP-SEARCH> ] and also that caches that cannot use the request

   payload as part of the cache key will not be able to cache responses

   to FETCH requests at all.)  The Max-Age option in the response has

   equivalent semantics to its use in a GET.

So, different payloads would create different cache keys and hence individually be unique.

Regards

Jon

From: Simon Bernard [mailto: [email-masked]] 
Sent: 29 June 2021 10:19
To: [email-masked] WG
Subject: [core] More precision about CoAP Observe with FETCH

Hi all,

  The PATCH and FETCH Methods for the Constrained Application Protocol (CoAP) (RFC8132 <https://datatracker.ietf.org/doc/html/rfc8132> ) says that FETCH can be used with RFC7641 <https://datatracker.ietf.org/doc/html/rfc7641>  (Observing Resources in CoAP)

2.4 <https://datatracker.ietf.org/doc/html/rfc8132#section-2.4> .  Working with Observe
 
   The Observe option [RFC7641 <https://datatracker.ietf.org/doc/html/rfc7641> ] can be used with a FETCH request as it
   can be used with a GET request

  But "CoAP Observe" seems to be designed with a "GET without payload" in mind.
  E.g. it says : 

3.1 <https://datatracker.ietf.org/doc/html/rfc7641#section-3.1> .  Request

The target resource is not identified by the payload.  So 2 FETCH requests on same resource with 2 different payload seem to not be allowed ? 

Is it intended or just an oversight ? if this is intended, is there any particular reason about this ? 

Simon

---

From: Simon Bernard <[email-masked]>
Date: Tue, 29 Jun 2021 11:57:51 +0200

Thx a lot for this clarification.

Le 29/06/2021 à 11:45, Jon Shallow a écrit :
>
> Hi Simon,
>
> As per https://datatracker.ietf.org/doc/html/rfc8132#section-2 
> <https://datatracker.ietf.org/doc/html/rfc8132#section-2> the FEETCH 
> request body is a part of the cache key.
>
>    Depending on the response code as defined by [RFC7252 
> <https://datatracker.ietf.org/doc/html/rfc7252>], the response
>
>    [HTTP-SEARCH 
> <https://datatracker.ietf.org/doc/html/rfc8132#ref-HTTP-SEARCH>] and 
> also that caches that cannot use the request
>
> *From:*Simon Bernard [mailto: [email-masked]]
> *Sent:* 29 June 2021 10:19
> *To:* [email-masked] WG
> *Subject:* [core] More precision about CoAP Observe with FETCH
>
> Hi all,
>
>   The PATCH and FETCH Methods for the Constrained Application Protocol 
> (CoAP) (RFC8132 <https://datatracker.ietf.org/doc/html/rfc8132>) says 
> that FETCH can be used with RFC7641 
> <https://datatracker.ietf.org/doc/html/rfc7641> (Observing Resources 
> in CoAP)
>
>     2.4 <https://datatracker.ietf.org/doc/html/rfc8132#section-2.4>. 
>     Working with Observe
>
>         The Observe option [RFC7641  <https://datatracker.ietf.org/doc/html/rfc7641>] can be used with a FETCH request as it
>
>     3.1 <https://datatracker.ietf.org/doc/html/rfc7641#section-3.1>.
>      Request
>
>         normal GET) request if the target resource is the same.*A client*
>
>     *   MUST aggregate such requests and MUST NOT register more than
>     once for*
>
>     *   the same target resource.  The target resource is identified
>     by all*
>
>     *   options in the request that are part of the Cache-Key. This
>     includes,*
>
>     *   for example, the full request URI and the Accept Option.*   
>

---

From: Simon Bernard <[email-masked]>
Date: Tue, 29 Jun 2021 12:13:36 +0200

Hi Jon,

   Another question related to this topic (FETCH + Observe)

   For an Active Cancel Observe request, RFC7641 says 
(https://datatracker.ietf.org/doc/html/rfc7641#section-3.6):

>     In some circumstances, it may be desirable to cancel an observation
>     and release the resources allocated by the server to it more eagerly.
>     In this case, a client MAY explicitly deregister by issuing a GET
>     request that has the Token field set to the token of the observation
>     to be cancelled and includes an Observe Option with the value set to
>     1 (deregister).  All other options MUST be identical to those in the
>     registration request except for the set of ETag Options.  When the
>     server receives such a request, it will remove any matching entry
>     from the list of observers and process the GET request as usual.

In case of usage of FETCH with payload. Should we also sent the payload 
used to establish the observe relation in this "cancel request" ?

Simon

---

From: "Jon Shallow" <[email-masked]>
Date: Tue, 29 Jun 2021 13:15:36 +0100

Hi Simon,

Yes, because it is a part of the cache-key, you also need to send the payload as well for the Observe cancel is my understanding.

Regard

Jon

From: Simon Bernard [mailto: [email-masked]] 
Sent: 29 June 2021 11:14
To: Jon Shallow; [email-masked]
Subject: Re: [core] More precision about CoAP Observe with FETCH

Hi Jon,

  For an Active Cancel Observe request, RFC7641 says (https://datatracker.ietf.org/doc/html/rfc7641#section-3.6): 

In case of usage of FETCH with payload. Should we also sent the payload used to establish the observe relation in this "cancel request" ? 

Simon

Hi Simon,

Regards

Jon

Hi all,

 

 

Simon