IROActiveEventChannel

Overview

The IROActiveEventChannel interface is used to register a new TROEventReceiver object with the specified channel.

The TROEventReceiver visual component is used on the client side to poll or actively receive callback event messages from a server and initiate the execution of the events (more information about TROEventReceiver see Event Sinks and Server Callbacks).

The IROActiveEventChannel interface contains two procedures to register and unregister the TROEventReceiver. You can define these procedures in your custom channel.

For example, consider the procedures RegisterEventReceiver and CallbackEvents in the TROBaseActiveEventChannel class.

procedure TROBaseActiveEventChannel.RegisterEventReceiver(aReceiver: IROEventReceiver);
begin
  if (aReceiver <> nil) and (fEventReceiverList.IndexOf(aReceiver) = -1) then begin
    fEventReceiverList.Add(aReceiver);
  ...
end;

procedure TROBaseActiveEventChannel.CallbackEvents(aData: TStream;
  aThread: TThread);
var
  i: integer;
begin
  ...
  for I := 0 to fEventReceiverList.Count - 1 do
    (fEventReceiverList[i] as IROEventReceiver).Dispatch(aData, aThread);
  ...
end;

In the TROBaseActiveEventChannel class, the new TROEventReceiver class is added to the event receiver list fEventReceiverList and is then used as a receiver for callback events.

Location


Required Methods


RegisterEventReceiver

Registers a new event receiver object aReceiver in the specified channel. This procedure is needed to further use the aReceiver as receiver for callback events.

procedure RegisterEventReceiver(aReceiver: IROEventReceiver)

Parameters:

  • aReceiver: the event receiver that should be registered.

UnregisterEventReceiver

Unregisters the specified IROEventReceiver aReceiver in the specified channel.

procedure UnregisterEventReceiver(aReceiver: IROEventReceiver)

Parameters:

  • aReceiver: The event receiver that should be unregistered.