Class IpcRelayServiceBroker
- Namespace
- Nerdbank.JsonRpc.BrokeredServices
- Assembly
- Nerdbank.JsonRpc.dll
Relays a local broker through cancellable, single-client same-account IPC endpoints.
public sealed class IpcRelayServiceBroker : IRemoteServiceBroker, IShapeable<IRemoteServiceBroker>, IDisposable, IAsyncDisposable
- Inheritance
-
IpcRelayServiceBroker
- Implements
- Inherited Members
Constructors
IpcRelayServiceBroker(IServiceBroker)
Initializes a new instance of the IpcRelayServiceBroker class.
public IpcRelayServiceBroker(IServiceBroker broker)
Parameters
brokerIServiceBrokerThe broker to relay, including per-registration metadata.
Properties
ConnectionTimeout
Gets the maximum time to wait for an allocated endpoint to be claimed.
public TimeSpan ConnectionTimeout { get; init; }
Property Value
Remarks
Unclaimed endpoints are reclaimed even if a client disappears without canceling.
Logger
Gets the relay logger.
public ILogger<IpcRelayServiceBroker> 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()
DisposeAsync()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources asynchronously.
public ValueTask DisposeAsync()
Returns
- ValueTask
A task that represents the asynchronous dispose operation.
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