WebTransportListener Class

Listens for WebTransport sessions over HTTP/3.

public sealed class WebTransportListener : IAsyncDisposable

Remarks

The listener accepts the QUIC connections and their WebTransport CONNECT requests. The other requests are answered with a 501 response. A connection can carry several sessions.

Implements

Properties

NameDescription
LocalEndPointGets the address the listener listens on.

Gets the address the listener listens on.

public IPEndPoint LocalEndPoint { get; }

Property value

IPEndPoint

Methods

NameDescription
AcceptAsync(CancellationToken)Waits for the next WebTransport CONNECT request.
DisposeAsync()Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources asynchronously.
ListenAsync(WebTransportListenerOptions, CancellationToken)Starts listening.

AcceptAsync(CancellationToken)

WebTransportListener.cs

Waits for the next WebTransport CONNECT request.

net10.0

public ValueTask<WebTransportSessionRequest> AcceptAsync(CancellationToken cancellationToken = default)

net11.0

public ValueTask<WebTransportSessionRequest> AcceptAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Returns

ValueTask<WebTransportSessionRequest>

Exceptions

ObjectDisposedException
The listener is disposed.

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources asynchronously.

net10.0

public ValueTask DisposeAsync()

net11.0

public ValueTask DisposeAsync()

Returns

ValueTask A task that represents the asynchronous dispose operation.

ListenAsync(WebTransportListenerOptions, CancellationToken)

WebTransportListener.cs

Starts listening.

net10.0

public static ValueTask<WebTransportListener> ListenAsync(WebTransportListenerOptions options, CancellationToken cancellationToken = default)

net11.0

public static ValueTask<WebTransportListener> ListenAsync(WebTransportListenerOptions options, CancellationToken cancellationToken = default)

Parameters

options WebTransportListenerOptions
cancellationToken CancellationToken

Returns

ValueTask<WebTransportListener>

Exceptions

PlatformNotSupportedException
MsQuic is not available.