TsgcHTTP3Server › Events › OnH3Connect

OnH3Connect Event

Fires when a client establishes an HTTP/3 connection.

Syntax

property OnH3Connect: TsgcQUICServerConnectEvent;
// TsgcQUICServerConnectEvent = procedure(Sender: TObject; const aConnection: TsgcQUICServerConnection) of object

Default Value

—

Parameters

NameTypeDescription
SenderTObjectThe TsgcHTTP3Server instance that raised the event.
aConnectionconst TsgcQUICServerConnectionNewly established QUIC connection. Exposes PeerIP, PeerPort, CreatedAt and connection state. In .NET this parameter is a string holding the peer endpoint, which acts as the connection id.

Remarks

OnH3Connect is raised after a client has completed the QUIC handshake (including the TLS 1.3 exchange and ALPN negotiation of h3) and the server has opened the HTTP/3 control and QPACK streams, meaning the connection is ready to carry requests. The event fires once per connection, before any OnH3Request. Use the aConnection parameter to log the peer or to initialize per-connection context.

The event is raised on the server's background listener thread, so it must not touch the UI directly.

Do not hold the aConnection reference beyond the lifetime of the connection: it is released once OnH3Disconnect has fired for it.

Example


procedure OnH3ConnectEvent(Sender: TObject; const aConnection:
    TsgcQUICServerConnection);
begin
  Log('HTTP/3 client connected from ' + aConnection.PeerIP);
end;

Back to Events