TsgcWSPServer_sgc › Events › OnBeforePublish
Fires before a client publication is broadcast; the handler can rewrite or deny it.
property OnBeforePublish: TsgcWSBeforePublish;
// TsgcWSBeforePublish = procedure(Connection: TsgcWSConnection; const aChannel: String; var aText: String; var Accept: Boolean) of object
—
Raised while processing a client-originated Publish, before the message reaches any subscriber. Inspect aChannel to authorise the publication, mutate aText to filter or rewrite the payload, and set Accept to False to drop the message silently. Accept arrives initialised to True.
procedure TForm1.oProtocolBeforePublish(Connection: TsgcWSConnection;
const aChannel: String; var aText: String; var Accept: Boolean);
begin
Accept := aChannel <> 'private';
end;