TsgcHTTP2ClientMethods › ConnectAsync

ConnectAsync Method

Opens the HTTP/2 session and sends a non-blocking GET; the response is routed to OnHTTP2Response.

Syntax

procedure ConnectAsync(const aURL: string);

Parameters

NameTypeDescription
aURLconst stringAbsolute URL used for the initial GET request. The scheme determines whether the transport is TLS-encrypted (h2) or cleartext (h2c).

Remarks

Unlike Connect, this variant returns immediately after dispatching the request. The response body and headers are delivered asynchronously through the OnHTTP2Response event, keeping the calling thread free to issue additional requests on the same multiplexed session.

Example

oClient.OnHTTP2Response := OnHTTP2ResponseEvent;
oClient.ConnectAsync('https://api.example.com/status');

Back to Methods