TsgcWSPServer_Dataset › Events › OnBeforeSubscription
Fires before a subscription is accepted; the handler can deny or authorise it.
property OnBeforeSubscription: TsgcWSBeforeSubscriptionEvent;
// TsgcWSBeforeSubscriptionEvent = procedure(Connection: TsgcWSConnection; const Subscription: String; var Accept: Boolean) of object
—
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.
procedure TForm1.oProtocolBeforeSubscription(Connection: TsgcWSConnection;
const Subscription: String; var Accept: Boolean);
begin
Accept := not Subscription.StartsWith('admin.');
end;