onNotification (event)

Fires when a notification is received from the server.

Syntax

- (void)onNotification:(NSString*)URI :(BOOL)isLatest :(int*)stopObserving;
func onNotification(_ URI: String, _ isLatest: Bool, _ stopObserving: inout Int32)

Remarks

This event fires when the class receives a notification from that server that some observed resource has changed. Query the ResponseCode, ResponseData, ResponseContentFormat, ResponseETag, and ResponseOption* properties to obtain the new resource information.

Note that, in some cases, the server may no longer be able to deliver notifications for a resource (e.g., if it is deleted). In such cases, the ResponseCode property will be populated with a non-2.xx code (e.g., 4.04 "Not Found") to indicate why the resource can no longer be observed. No further notifications will be delivered for the resource after such a notification arrives.

The URI parameter identifies the resource that has changed.

The IsLatest parameter reflects whether this notification actually has the most recent resource information available, since it is possible for notifications to arrive out of order under certain circumstances.

The StopObserving parameter specifies whether the class should stop observing the resource identified by URI. This parameter is False by default, set it to True to have the class unregister itself from further notifications. (Note: in the event of a non-2.xx notification, this parameter will be True by default instead, and changing it to False will have no effect.)

Note: This event is only used when the class 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 iOS Edition - Version 20.0 [Build 8265]