TsgcHTTP3Server › Events › OnH3Disconnect
Fires when an HTTP/3 connection is closed.
property OnH3Disconnect: TsgcQUICServerDisconnectEvent;
// TsgcQUICServerDisconnectEvent = procedure(Sender: TObject; const aConnection: TsgcQUICServerConnection; aCode: Int64; const aReason: string) of object
—
| Name | Type | Description |
|---|---|---|
Sender | TObject | The TsgcHTTP3Server instance that raised the event. |
aConnection | const TsgcQUICServerConnection | Connection that has been closed. In .NET this parameter is a string holding the peer endpoint, which acts as the connection id. |
aCode | Int64 | Close code. Zero for a normal close; otherwise the underlying error code. |
aReason | const string | Human-readable reason for the disconnection, when available. |
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.
procedure OnH3DisconnectEvent(Sender: TObject; const aConnection:
TsgcQUICServerConnection; aCode: Int64; const aReason: string);
begin
Log('HTTP/3 client disconnected: ' + aReason);
end;