TsgcWSPServer_WebRTCEvents › OnSubscription

OnSubscription Event

Fires after a peer subscription has been accepted and the signalling server has registered the peer on the channel.

Syntax

property OnSubscription: TsgcWSSubscriptionEvent;
// TsgcWSSubscriptionEvent = procedure(Connection: TsgcWSConnection; const Subscription: String) of object

Default Value

Remarks

Runs immediately after OnBeforeSubscription returned Accept := True, the subscriber list for the channel has been updated and an acknowledgment frame (carrying the current subscriber count) has been sent back to the peer. This is the right place to log joins, emit audit metrics or, when the subscriber count reaches two, kick off a server-side workflow that expects both peers to be present. The handler is informational only — use OnBeforeSubscription to reject joins.

Example


procedure TForm1.WebRTCServerSubscription(Connection: TsgcWSConnection;
  const Subscription: String);
begin
  Memo1.Lines.Add(Format('[%s] joined room %s',
    [Connection.Guid, Subscription]));
end;

Back to Events