Class BiDiOptionsBuilder
Provides a fluent API for configuring BiDi connection options, such as the underlying transport mechanism.
public sealed class BiDiOptionsBuilder
- Inheritance
-
BiDiOptionsBuilder
- Inherited Members
Methods
UseTransport(Func<Func<Uri, CancellationToken, Task<ITransport>>, Func<Uri, CancellationToken, Task<ITransport>>>)
Composes a transport factory into the current transport pipeline.
public BiDiOptionsBuilder UseTransport(Func<Func<Uri, CancellationToken, Task<ITransport>>, Func<Uri, CancellationToken, Task<ITransport>>> next)
Parameters
nextFunc<Func<Uri, CancellationToken, Task<ITransport>>, Func<Uri, CancellationToken, Task<ITransport>>>A callback that composes a new transport factory from the current one.
Returns
- BiDiOptionsBuilder
The current BiDiOptionsBuilder instance for chaining.
Remarks
The next callback receives the current transport factory and returns
the next factory in the chain. BiDi takes ownership of the transport instance returned by
the final factory and will dispose it.
UseWebSocket(Action<ClientWebSocketOptions>?)
Configures the BiDi connection to use a WebSocket transport.
public BiDiOptionsBuilder UseWebSocket(Action<ClientWebSocketOptions>? configure = null)
Parameters
configureAction<ClientWebSocketOptions>An optional action to configure the ClientWebSocketOptions before connecting.
Returns
- BiDiOptionsBuilder
The current BiDiOptionsBuilder instance for chaining.
Remarks
WebSocket is the default transport; calling this method is only necessary when you need to customize the underlying ClientWebSocketOptions (e.g., to set headers, proxy, or certificates).