TsgcHTTP3Server › Events › OnH3Disconnect

OnH3Disconnect Event

Fires when an HTTP/3 connection is closed.

Syntax

property OnH3Disconnect: TsgcQUICServerDisconnectEvent;
// TsgcQUICServerDisconnectEvent = procedure(Sender: TObject; const aConnection: TsgcQUICServerConnection; aCode: Int64; const aReason: string) of object

Default Value

—

Parameters

NameTypeDescription
SenderTObjectThe TsgcHTTP3Server instance that raised the event.
aConnectionconst TsgcQUICServerConnectionConnection that has been closed. In .NET this parameter is a string holding the peer endpoint, which acts as the connection id.
aCodeInt64Close code. Zero for a normal close; otherwise the underlying error code.
aReasonconst stringHuman-readable reason for the disconnection, when available.

Remarks

OnH3Disconnect is raised when a client closes its HTTP/3 connection or when the connection is dropped because of a transport error. After the event the connection object is released, so any per-connection state held by the application should be discarded here, and the aConnection reference must not be used afterwards. A normal, peer-initiated close reports aCode = 0 with an empty aReason; an error close reports the underlying error code and a short description.

The event also fires for every connection torn down by Stop, and it is raised on the server's background listener thread, so it must not touch the UI directly.

Example


procedure OnH3DisconnectEvent(Sender: TObject; const aConnection:
    TsgcQUICServerConnection; aCode: Int64; const aReason: string);
begin
  Log('HTTP/3 client disconnected: ' + aReason);
end;

Back to Events