samples: net: sockets: coap_client: Make use of CoAP APIs for observe

The sample oversimplified the observe mechanism a bit - instead of
making use of CoAP APIs to verify the packets received (if they are
actually notifications for the observe) it blindly assumed that any
received packet was a notification. This could be misleading for
potential users of the CoAP library, as the sample had little use as
a reference for the Observer functionality.

Fix this by making use of `coap_reply` structure and a corresponding
`coap_response_received()` function.

Additionally, make the observe cancellation compliant with the CoAP
specification - it should be either an empty Reset message, or a GET
request with Observe option set to 1. The sample used invalid
construct of a Reset message with Observe option. For the purpose of
the sample, use the latter option.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
1 file changed