IPWorks IoT 2020 Delphi Edition

Questions / Feedback?

Register Event

Fires when a client wishes to register for notifications.

Syntax

type TRegisterEvent = procedure (
  Sender: TObject;
  const RemoteHost: String;
  RemotePort: Integer;
  const URI: String;
  const URIHost: String;
  URIPort: Integer;
  const URIPath: String;
  const URIQuery: String;
  Token: String;
  TokenB: TBytes;
  var Accept: Boolean
) of Object;

property OnRegister: TRegisterEvent read FOnRegister write FOnRegister;

Remarks

This event fires anytime a client wishes to register itself as an observer for the resource identified by URI. Refer to the StartObserving and SendNotification methods, as well as the Notification event, for more information about observing resources and resource change notifications.

Any options included in the request can be obtained by querying the RequestOption* properties.

To correctly handle this event, populate the ResponseCode, ResponseData, ResponseContentFormat, ResponseETag, and ResponseOption* properties as desired before this event finishes. (This must be done regardless of the Accept parameter's final value; see below for more information on why).

The RemoteHost parameter reflects the client's IP address or hostname.

The RemotePort parameter reflects the client's port.

The URI parameter reflects the exact resource URI that the client wishes to observe (the CoAP specification states that the full URI must be used to track observers). This value must be passed exactly as-is to the SendNotification method to notify observers of changes to the resource.

The URIHost, URIPort, URIPath, and URIQuery parameters are provided for additional convenience

The Token parameter reflects the token included in the registration request.

The Accept parameter specifies whether the component should accept the registration. By default, it is False, and the request will be treated like a normal GET request. Setting it to True will cause the component to add the client to its internal list of registered observers for the specified URI.

Note: This event is only used when the component is operating in server mode (i.e., when the Listening property is enabled).

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