Table of Contents

Class JsonRpcDescriptor

Namespace
Nerdbank.JsonRpc.BrokeredServices
Assembly
Nerdbank.JsonRpc.dll

Describes immutable settings shared by independent service connections.

public abstract record JsonRpcDescriptor : IJsonRpcDescriptor, IEquatable<JsonRpcDescriptor>
Inheritance
JsonRpcDescriptor
Implements
Derived
Inherited Members

Constructors

JsonRpcDescriptor(ServiceMoniker)

Initializes a new instance of the JsonRpcDescriptor class.

protected JsonRpcDescriptor(ServiceMoniker moniker)

Parameters

moniker ServiceMoniker

The service identity.

Properties

AdditionalInterfaces

Gets known additional contracts, keyed by stable capability identifiers.

public IReadOnlyList<ServiceInterface> AdditionalInterfaces { get; init; }

Property Value

IReadOnlyList<ServiceInterface>

Remarks

These are potential capabilities, not a declaration that every implementation supports them.

CallbackInterface

Gets the captured client callback contract, if any.

public ServiceInterface? CallbackInterface { get; init; }

Property Value

ServiceInterface

Moniker

Gets the identity of the service.

public ServiceMoniker Moniker { get; init; }

Property Value

ServiceMoniker

MultiplexingStreamOptions

Gets options for a dedicated connection-owned multiplexer, or null to disable multiplexing.

public MultiplexingStream.Options? MultiplexingStreamOptions { get; init; }

Property Value

MultiplexingStream.Options

The default is null.

Remarks

Set ProtocolMajorVersion to 3 for handshake-free connection setup. Version 3 or later is required, and both endpoints must agree on the protocol version and seeded channels. The options are captured as a frozen copy. Seeded channel 0 is reserved for RPC; applications may use any other configured seeded channels. If no seeded channels are configured, one is created for RPC. Configured channel indices are preserved.

ProxyOptions

Gets client naming and argument conventions.

public JsonRpcProxyOptions ProxyOptions { get; init; }

Property Value

JsonRpcProxyOptions

RpcOptions

Gets immutable connection policies.

public JsonRpcOptions RpcOptions { get; init; }

Property Value

JsonRpcOptions

TargetOptions

Gets server naming and event conventions.

public JsonRpcTargetOptions TargetOptions { get; init; }

Property Value

JsonRpcTargetOptions

Methods

AddRpcTargetCore(JsonRpc, object, IReadOnlyList<ServiceInterface>)

Registers a service after its type has been erased for catalog storage.

protected abstract void AddRpcTargetCore(JsonRpc connection, object target, IReadOnlyList<ServiceInterface> additionalInterfaces)

Parameters

connection JsonRpc

The unstarted connection.

target object

The service implementation.

additionalInterfaces IReadOnlyList<ServiceInterface>

The supported optional contracts.

CreateCallbackProxy(JsonRpc)

Constructs the client's callback proxy on an unstarted server connection.

public virtual object? CreateCallbackProxy(JsonRpc connection)

Parameters

connection JsonRpc

The server connection.

Returns

object

The callback proxy, or null if the service has no callback contract.

CreateChannel(IDuplexPipe)

Creates the encoding-specific channel for a connection.

protected abstract JsonRpcPipeChannel CreateChannel(IDuplexPipe pipe)

Parameters

pipe IDuplexPipe

The connected transport.

Returns

JsonRpcPipeChannel

The channel that owns the transport.

CreateConnection(IDuplexPipe, ServiceRpcContext?)

Constructs an unstarted connection. Successful construction transfers pipe ownership.

public virtual JsonRpc CreateConnection(IDuplexPipe pipe, ServiceRpcContext? context = null)

Parameters

pipe IDuplexPipe

The connected transport.

context ServiceRpcContext

Runtime infrastructure for this connection.

Returns

JsonRpc

The connection, whose owner must dispose it.

Remarks

Implementations that initialize a transport wrapper may transfer ownership before construction completes, including on failure.

CreateInterface<TAdditional>(string)

Captures an additional source-generated contract.

public ServiceInterface<TAdditional> CreateInterface<TAdditional>(string id) where TAdditional : class, IShapeable<TAdditional>

Parameters

id string

The stable capability identifier.

Returns

ServiceInterface<TAdditional>

The contract registration metadata.

Type Parameters

TAdditional

The additional service interface.

CreateInterface<TAdditional>(string, ITypeShape<TAdditional>)

Captures an additional contract with an explicit shape.

public ServiceInterface<TAdditional> CreateInterface<TAdditional>(string id, ITypeShape<TAdditional> interfaceShape) where TAdditional : class

Parameters

id string

The stable capability identifier.

interfaceShape ITypeShape<TAdditional>

The source-generated shape.

Returns

ServiceInterface<TAdditional>

The contract registration metadata.

Type Parameters

TAdditional

The additional service interface.

CreateInterface<TAdditional, TProvider>(string)

Captures an additional contract using a source-generated witness.

public ServiceInterface<TAdditional> CreateInterface<TAdditional, TProvider>(string id) where TAdditional : class where TProvider : IShapeable<TAdditional>

Parameters

id string

The stable capability identifier.

Returns

ServiceInterface<TAdditional>

The contract registration metadata.

Type Parameters

TAdditional

The additional interface.

TProvider

The source-generated shape provider.

CreateLocalCallback(object, ILogger<ServiceProxyContext>?)

Constructs a direct callback boundary without owning the caller's target.

public virtual object CreateLocalCallback(object target, ILogger<ServiceProxyContext>? logger = null)

Parameters

target object

The caller-owned callback implementation.

logger ILogger<ServiceProxyContext>

The direct callback logger.

Returns

object

The generated, activation-owned callback boundary.

CreateLocalTargetCore(ServiceProxyContext, IReadOnlyList<ServiceInterface>)

Constructs a forwarding target after its contract type has been erased.

protected abstract object CreateLocalTargetCore(ServiceProxyContext context, IReadOnlyList<ServiceInterface> additionalInterfaces)

Parameters

context ServiceProxyContext

The activation context.

additionalInterfaces IReadOnlyList<ServiceInterface>

The supported optional contracts.

Returns

object

The forwarding target.