Table of Contents

Class JsonRpcMessagePackChannel

Namespace
Nerdbank.JsonRpc
Assembly
Nerdbank.JsonRpc.dll

Encodes JSON-RPC messages as MessagePack over a duplex pipe, framed as described by JsonRpcMessagePackFraming. Inbound frames are limited by MaximumMessageSize.

public class JsonRpcMessagePackChannel : JsonRpcPipeChannel, IAsyncDisposable
Inheritance
JsonRpcMessagePackChannel
Implements
Inherited Members

Constructors

JsonRpcMessagePackChannel(IDuplexPipe, MessagePackSerializer, JsonRpcMessagePackFraming, int?, int?)

Initializes a new instance of the JsonRpcMessagePackChannel class with a configured serializer and framing.

public JsonRpcMessagePackChannel(IDuplexPipe pipe, MessagePackSerializer serializer, JsonRpcMessagePackFraming framing, int? inboundCapacity = 100, int? outboundCapacity = null)

Parameters

pipe IDuplexPipe

The connected duplex pipe.

serializer MessagePackSerializer

The serializer for MessagePack application values and envelopes.

framing JsonRpcMessagePackFraming

The wire framing convention, which both parties must agree on.

inboundCapacity int?

The inbound queue limit, or null for an unbounded queue.

outboundCapacity int?

The outbound queue limit, or null for an unbounded queue.

JsonRpcMessagePackChannel(IDuplexPipe, MessagePackSerializer, int?, int?)

Initializes a new instance of the JsonRpcMessagePackChannel class with a configured serializer.

public JsonRpcMessagePackChannel(IDuplexPipe pipe, MessagePackSerializer serializer, int? inboundCapacity = 100, int? outboundCapacity = null)

Parameters

pipe IDuplexPipe

The connected duplex pipe.

serializer MessagePackSerializer

The serializer for MessagePack application values and envelopes.

inboundCapacity int?

The inbound queue limit, or null for an unbounded queue.

outboundCapacity int?

The outbound queue limit, or null for an unbounded queue.

JsonRpcMessagePackChannel(IDuplexPipe, int?, int?)

Initializes a new instance of the JsonRpcMessagePackChannel class with the default serializer.

public JsonRpcMessagePackChannel(IDuplexPipe pipe, int? inboundCapacity = 100, int? outboundCapacity = null)

Parameters

pipe IDuplexPipe

The connected duplex pipe.

inboundCapacity int?

The inbound queue limit, or null for an unbounded queue.

outboundCapacity int?

The outbound queue limit, or null for an unbounded queue.

Fields

DefaultFraming

The framing used when none is specified.

public const JsonRpcMessagePackFraming DefaultFraming = BigEndianInt32LengthHeader

Field Value

JsonRpcMessagePackFraming

Properties

DefaultSerializer

Gets the default serializer for MessagePack channels.

public static MessagePackSerializer DefaultSerializer { get; }

Property Value

MessagePackSerializer

Encoding

Gets the encoding used by this transport.

public override JsonRpcEncoding Encoding { get; }

Property Value

JsonRpcEncoding

Serializer

Gets the serializer selected by this channel for application values.

public override JsonRpcSerializer Serializer { get; }

Property Value

JsonRpcSerializer

Methods

ReceiveMessagesAsync(PipeReader, CancellationToken)

protected override IAsyncEnumerable<JsonRpcMessage> ReceiveMessagesAsync(PipeReader reader, CancellationToken cancellationToken)

Parameters

reader PipeReader
cancellationToken CancellationToken

Returns

IAsyncEnumerable<JsonRpcMessage>

SendMessageAsync(PipeWriter, JsonRpcMessage, CancellationToken)

protected override ValueTask SendMessageAsync(PipeWriter writer, JsonRpcMessage message, CancellationToken cancellationToken)

Parameters

writer PipeWriter
message JsonRpcMessage
cancellationToken CancellationToken

Returns

ValueTask