物联网coap协议observe的实现

coap observe

Posted by Dongyupu on June 13, 2016

参考OMA-TS-LightweightM2M-V1_0-20151214-C.pdf

  • 在实现一个演示用的demo时,为了快速验证,直接把github上的一个参考实现的server拿来改造了。

Library for building OMA Lightweight M2M Applications (client and server)

  • 随后发现这个参考并未按照标准来实现cancel observe,

5.5.3 Cancel Observation

  • The “Cancel Observation” operation is sent from the LWM2M Server to the LWM2M Client to end an observation relationship for Object Instance or Resource. Please note that this enabler provides two ways for the LWM2M Server to cancel observation:
      1. in response to a “Notify” operation for which it is not interested in any more, the LWM2M Server can send a “Reset Message”.
      1. at any moment, by sending a GET request with Observe option=1, the LWM2M Server can cancel an “Observe” operation on a specified Resource, or specified Object Instance(s) .
  • 按照规范上说的应该发一个Observe option=1 的请求给client端。