TsgcWSPServer_Files › Events › OnBeforeSubscription
Fired before a client is subscribed to a channel, allowing the server to accept or reject the subscription.
property OnBeforeSubscription: TsgcWSBeforeSubscriptionEvent;
// TsgcWSBeforeSubscriptionEvent = procedure(Connection: TsgcWSConnection; const Subscription: String; var Accept: Boolean) of object
—
Fired when a client requests a subscription but before it is added to the channel list. Set Accept to False to reject the subscription; the client will not receive messages or broadcast files for that channel. Useful for authorization checks.
procedure TForm1.oFilesBeforeSubscription(Connection: TsgcWSConnection;
const Subscription: String; var Accept: Boolean);
begin
Accept := Subscription <> 'admin';
end;