TsgcSTUNClientEvents › OnSTUNBeforeSend

OnSTUNBeforeSend Event

Fires just before a STUN message is sent to the server, allowing last-minute inspection or modification of the outgoing message.

Syntax

property OnSTUNBeforeSend: TsgcSTUNBeforeSendEvent;
// TsgcSTUNBeforeSendEvent = procedure(Sender: TObject; const aMessage: TsgcSTUN_Message) of object

Default Value

Remarks

Called after the STUN message has been built but before it is serialized to the wire. Use aMessage to read the method, transaction id and attribute list, or to add/remove custom attributes. This is the ideal hook to add tracing or to enforce protocol-level policies.

Example

procedure TForm1.oSTUNSTUNBeforeSend(Sender: TObject; const aMessage: TsgcSTUN_Message);
begin
  DoLog('Sending STUN message, transaction id: ' + aMessage.TransactionID);
end;

Back to Events