IPWorks IoT 2020 Python Edition

Questions / Feedback?

on_notification Event

Fires when a notification is received from the server.

Syntax

class CoAPNotificationEventParams(object):
  @property
  def uri() -> str: ...
  @property
  def is_latest() -> bool: ...
  @property
  def stop_observing() -> bool: ...
  @stop_observing.setter
  def stop_observing(value) -> None: ...

# In class CoAP:
@property
def on_notification() -> Callable[[CoAPNotificationEventParams], None]: ...
@on_notification.setter
def on_notification(event_hook: Callable[[CoAPNotificationEventParams], None]) -> None: ...

Remarks

This event fires when the class receives a notification from that server that some observed resource has changed. Query the response_code, response_data, response_content_format, response_e_tag, 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 response_code 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 Python Edition - Version 20.0 [Build 8265]