Table of Contents

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

broker IServiceBroker

The 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

TimeSpan

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

ILogger<IpcRelayServiceBroker>

Methods

CancelServiceRequestAsync(Guid, CancellationToken)

Releases an endpoint that the caller cannot or will not connect to.

public Task CancelServiceRequestAsync(Guid requestId, CancellationToken cancellationToken)

Parameters

requestId Guid

The allocated request identity.

cancellationToken CancellationToken

Cancels 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

moniker ServiceMoniker

The requested service.

cancellationToken CancellationToken

Cancels 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

connections RemoteServiceConnections

The client's supported transports.

cancellationToken CancellationToken

Cancels negotiation.

Returns

Task<int>

The selected protocol version. Unsupported transport sets fail explicitly.

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

moniker ServiceMoniker

The requested service.

options RemoteServiceActivationOptions

Transferable activation arguments and cultures.

cancellationToken CancellationToken

Cancels 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

Event Type

EventHandler<BrokeredServicesChangedEventArgs>