IPWorks IoT 2020 Delphi Edition

Questions / Feedback?

StartObserving Method

Registers the component as an observer for a given resource.

function StartObserving(URI: String): String;

Remarks

This method registers the component as an observer for the resource identified by URI. If the server accepts the registration, then it will periodically notify the component about any changes to the specified resource. These "change notifications" are exposed via the Notification event.

This method operates in the exact same manner as the Get method, with the exception of the two things listed below. Refer to the Get method's documentation for more information.

  1. When constructing the request, the component automatically includes an Observe option. The presence of this option is what indicates to the server that the component wishes to register itself as an observer for the specified resource.
  2. 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 component has successfully registered itself as an observer, the server will continue to deliver change notifications for the specified resource until the component 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 component is operating in client mode (i.e., when the Listening property is disabled).

Copyright (c) 2022 /n software inc. - All rights reserved.
IPWorks IoT 2020 Delphi Edition - Version 20.0 [Build 8265]