TsgcWSPServer_FilesEvents › OnBeforeSubscription

OnBeforeSubscription Event

Fired before a client is subscribed to a channel, allowing the server to accept or reject the subscription.

Syntax

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

Default Value

Remarks

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.

Example

procedure TForm1.oFilesBeforeSubscription(Connection: TsgcWSConnection;
  const Subscription: String; var Accept: Boolean);
begin
  Accept := Subscription <> 'admin';
end;

Back to Events