Registers the class as an observer for a given resource.
async coap.startObserving(URI : string): Promise<string>
This method registers the class as an observer for the resource identified by URI. If the server accepts the registration, then it will periodically notify the class about any changes to the specified resource. These "change notifications" are exposed via the Notification event.
- When constructing the request, the class automatically includes an Observe option. The presence of this option is what indicates to the server that the class wishes to register itself as an observer for the specified resource.
- When the server receives the request, its response causes the Notification event to fire instead of the RequestComplete event. (Unless it decides to reject the registration, in which case it will handle the request just like a normal GET request, and the RequestComplete event will fire when its response is received, just like it would if Get had been called.)
Once the class has successfully registered itself as an observer, the server will continue to deliver change notifications for the specified resource until the class unregisters, or the resource can no longer be observed (e.g., if it is deleted). To unregister, either call the StopObserving method with the same URI value, or set the Notification event's StopObserving parameter to True.
Note: This method can only be called when the class is operating in client mode (i.e., when the Listening property is disabled).