TsgcWSPServer_sgcイベント › OnBeforePublish

OnBeforePublish イベント

クライアントのパブリケーションがブロードキャストされる前に発生します。ハンドラーはそれを書き換えたり拒否したりできます。

構文

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

デフォルト値

解説

クライアント発のパブリッシュを処理中に、メッセージがサブスクライバーに届く前に発生します。aChannel を検査してパブリケーションを認可し、aText を変更してペイロードをフィルタリングまたは書き換え、Accept を False に設定してメッセージをサイレントにドロップします。Accept は True に初期化されています。

使用例

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

イベントに戻る