TsgcHTTP3Client › Methods › WebTransportConnect
Establishes a WebTransport session over an Extended CONNECT request.
function WebTransportConnect(const aURL: string): TsgcWebTransportSession;
| Name | Type | Description |
|---|---|---|
aURL | const string | Absolute URL of the WebTransport endpoint, for example https://www.example.com/wt. |
The established session, or nil when the server did not answer with status 200. (TsgcWebTransportSession)
WebTransportConnect performs the WebTransport handshake described in the WebTransport over HTTP/3 draft: it sends an Extended CONNECT request with :method=CONNECT and :protocol=webtransport, and on :status=200 wraps the resulting stream in a TsgcWebTransportSession. The session ID is the QUIC stream ID of the CONNECT stream.
A WebTransport session uses a dedicated QUIC connection, so any existing connection is closed first and multi-stream mode is enabled on the new one. The call blocks waiting for the server status, bounded by ConnectTimeout, and returns nil on any status other than 200. Check ServerSupportsWebTransport first to fail early.
The session supports streams only. Datagrams require the RFC 9221 QUIC DATAGRAM extension, which the OpenSSL builtin QUIC engine does not provide. Established sessions are tracked in WebTransportSessions.
Peer-opened streams are not harvested automatically. Call WebTransportProcessEvents periodically while the session is active so incoming streams surface on the session events.
In the .NET implementation this method is available on net8.0 and later only, and it returns a nullable reference. WebTransport support is compiled in only when the SGC_WEBTRANSPORT conditional define is enabled.
oSession := oClient.WebTransportConnect('https://www.example.com/wt');
if Assigned(oSession) then
begin
// drive the session so peer streams are harvested
oClient.WebTransportProcessEvents;
end;