TsgcWSPServer_sgcEvents › OnBeforePublish

OnBeforePublish Event

Fires before a client publication is broadcast; the handler can rewrite or deny it.

Syntax

property OnBeforePublish: TsgcWSBeforePublish;
// TsgcWSBeforePublish = procedure(Connection: TsgcWSConnection; const aChannel: String; var aText: String; var Accept: Boolean) of object

Default Value

Remarks

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.

Example

procedure TForm1.oProtocolBeforePublish(Connection: TsgcWSConnection;
  const aChannel: String; var aText: String; var Accept: Boolean);
begin
  Accept := aChannel <> 'private';
end;

Back to Events