Class MultiplexingRelayServiceBroker
- Namespace
- Nerdbank.JsonRpc.BrokeredServices
- Assembly
- Nerdbank.JsonRpc.dll
Relays brokered services over channels on a caller-owned multiplexing stream.
public sealed class MultiplexingRelayServiceBroker : IRemoteServiceBroker, IShapeable<IRemoteServiceBroker>, IDisposable
- Inheritance
-
MultiplexingRelayServiceBroker
- Implements
- Inherited Members
Constructors
MultiplexingRelayServiceBroker(IServiceBroker, MultiplexingStream)
Initializes a new instance of the MultiplexingRelayServiceBroker class.
public MultiplexingRelayServiceBroker(IServiceBroker broker, MultiplexingStream multiplexer)
Parameters
brokerIServiceBrokerThe broker, including per-registration capabilities.
multiplexerMultiplexingStreamThe caller-owned stream carrying service channels.
Properties
ConnectionTimeout
Gets the time allowed for clients to accept an offered channel.
public TimeSpan ConnectionTimeout { get; init; }
Property Value
Logger
Gets the logger used to observe channel and cleanup failures.
public ILogger<MultiplexingRelayServiceBroker> Logger { get; init; }
Property Value
Methods
CancelServiceRequestAsync(Guid, CancellationToken)
Releases an endpoint that the caller cannot or will not connect to.
public Task CancelServiceRequestAsync(Guid requestId, CancellationToken cancellationToken)
Parameters
requestIdGuidThe allocated request identity.
cancellationTokenCancellationTokenCancels the operation.
Returns
- Task
A task tracking cleanup.
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
GetCapabilitiesAsync(ServiceMoniker, CancellationToken)
Queries registration capabilities without activating a service.
public Task<IReadOnlyList<string>?> GetCapabilitiesAsync(ServiceMoniker moniker, CancellationToken cancellationToken = default)
Parameters
monikerServiceMonikerThe requested service.
cancellationTokenCancellationTokenCancels discovery.
Returns
- Task<IReadOnlyList<string>>
Stable capability identifiers, or null when unavailable.
HandshakeAsync(RemoteServiceConnections, CancellationToken)
Negotiates a broker protocol version and service-channel transport.
public Task<int> HandshakeAsync(RemoteServiceConnections connections, CancellationToken cancellationToken)
Parameters
connectionsRemoteServiceConnectionsThe client's supported transports.
cancellationTokenCancellationTokenCancels negotiation.
Returns
RequestServiceChannelAsync(ServiceMoniker, RemoteServiceActivationOptions, CancellationToken)
Allocates a service endpoint and returns its registration's actual capabilities.
public Task<RemoteServiceConnectionInfo?> RequestServiceChannelAsync(ServiceMoniker moniker, RemoteServiceActivationOptions options, CancellationToken cancellationToken)
Parameters
monikerServiceMonikerThe requested service.
optionsRemoteServiceActivationOptionsTransferable activation arguments and cultures.
cancellationTokenCancellationTokenCancels allocation.
Returns
- Task<RemoteServiceConnectionInfo>
The connection instructions, or null if unavailable.
Events
AvailabilityChanged
Occurs when queried services may have changed.
public event EventHandler<BrokeredServicesChangedEventArgs>? AvailabilityChanged