TsgcTURNServerEreignisse › OnTURNCreateAllocation

OnTURNCreateAllocation Ereignis

Wird ausgelöst, nachdem eine neue Allocation erfolgreich für einen Client erstellt wurde.

Syntax

property OnTURNCreateAllocation: TsgcTURNAllocationEvent;
// TsgcTURNAllocationEvent = procedure(Sender: TObject; const aSocket: TsgcSocketConnection; const Allocation: TsgcTURNAllocationItem) of object

Standardwert

Hinweise

Wird einmal pro erfolgreichem ALLOCATE ausgelöst, unmittelbar nachdem die Allocation der internen Tabelle des Servers hinzugefügt und die AllocateResponse an den Client gesendet wurde. Allocation stellt den vollständigen Kontext bereit: LocalIP/LocalPort (serverseitiger Listening-Endpunkt), ReflexiveIP/ReflexivePort (zugeordnete Adresse des Clients), RelayIP/RelayPort (die dem Client über XOR-RELAYED-ADDRESS angekündigte relayte Transportadresse), Username/Realm, Lifetime / Expiry sowie die Unter-Collections Permissions / Channels. Verwenden Sie es zum Aktualisieren von Betriebs-Dashboards, der Abrechnung oder benutzerspezifischen Kontingenten. Die Allocation-Instanz gehört dem Server — geben Sie sie nicht frei; sie wird erneut an OnTURNDeleteAllocation übergeben, wenn die Allocation abläuft. Läuft im Listener-Thread, sofern NotifyEvents es nicht umleitet.

Beispiel

procedure TForm1.OnTURNCreateAllocation(Sender: TObject;
  const aSocket: TsgcSocketConnection; const Allocation: TsgcTURNAllocationItem);
begin
  Memo1.Lines.Add(Format('Allocation created: user=%s relay=%s:%d lifetime=%d',
    [Allocation.Username, Allocation.RelayIP, Allocation.RelayPort,
     Allocation.Lifetime]));
end;

Zurück zu Ereignissen