code: async def _observe(self, api_command):
          
          duration = api_command.observe_duration
          url = api_command.url(self._host)
          err_callback = api_command.err_callback
  
          msg = Message(code=Code.GET, uri=url, observe=duration)
  
          # Note that this is necessary to start observing
          pr, r = await self._get_response(msg)
  
          api_command.result = _process_output(r)
  
          def success_callback(res):
              api_command.result = _process_output(res)
  
          def error_callback(ex):
              err_callback(ex)
  
          ob = pr.observation
          ob.register_callback(success_callback)
          ob.register_errback(error_callback)
          self._observations_err_callbacks.append(ob.error)
docs: Observe an endpoint.