TsgcWSPServer_sgcEvents › OnBeforeSubscription

OnBeforeSubscription Event

Fires before a subscription is accepted; the handler can deny or authorise it.

Syntax

property OnBeforeSubscription: TsgcWSBeforeSubscriptionEvent;
// TsgcWSBeforeSubscriptionEvent = procedure(Connection: TsgcWSConnection; const Subscription: String; var Accept: Boolean) of object

Default Value

Remarks

Raised when a client calls Subscribe, once per channel (wildcard subscriptions are expanded before the event fires). Inspect Subscription to check the channel name and set Accept to False to refuse the subscription; the client receives no Subscribe confirmation in that case. Accept arrives initialised to True.

Example

procedure TForm1.oProtocolBeforeSubscription(Connection: TsgcWSConnection;
  const Subscription: String; var Accept: Boolean);
begin
  Accept := not Subscription.StartsWith('admin.');
end;

Back to Events