TsgcHTTP2Client › Events › OnHTTP2Connect
Fires just after the client connects successfully to the HTTP/2 server.
property OnHTTP2Connect: TsgcHTTP2ClientConnectEvent;
// TsgcHTTP2ClientConnectEvent = procedure(Sender: TObject; const Connection: TsgcHTTP2ConnectionClient) of object
—
OnHTTP2Connect is raised after the TCP socket has been opened, the TLS handshake (if enabled) has succeeded, the HTTP/2 preface has been exchanged and the initial SETTINGS frame has been acknowledged, meaning the client is ready to send requests. The Connection parameter exposes the active session (remote host, protocol negotiated through ALPN, stream state...) so the application can log the connection or initialize per-session context. The event can be raised again when a WatchDog reconnection is triggered.
procedure OnHTTP2ConnectEvent(Sender: TObject; const Connection: TsgcHTTP2ConnectionClient);
begin
Log('HTTP/2 connected to ' + Connection.PeerIP);
end;