TsgcWSPServer_sgc › 이벤트 › OnBeforeSubscription
구독이 수락되기 전에 발생합니다. 핸들러가 이를 거부하거나 승인할 수 있습니다.
property OnBeforeSubscription: TsgcWSBeforeSubscriptionEvent;
// TsgcWSBeforeSubscriptionEvent = procedure(Connection: TsgcWSConnection; const Subscription: String; var Accept: Boolean) of object
—
클라이언트가 Subscribe를 호출할 때 채널당 한 번 발생합니다(와일드카드 구독은 이벤트 발생 전에 확장됩니다). Subscription을 검사하여 채널 이름을 확인하고, 구독을 거부하려면 Accept를 False로 설정하십시오. 그러면 클라이언트는 Subscribe 확인을 받지 못합니다. Accept는 True로 초기화되어 도착합니다.
procedure TForm1.oProtocolBeforeSubscription(Connection: TsgcWSConnection;
const Subscription: String; var Accept: Boolean);
begin
Accept := not Subscription.StartsWith('admin.');
end;