Table of Contents

Class StreamMessageHandler

Namespace
StreamJsonRpc
Assembly
StreamJsonRpc.dll

An abstract base class for for sending and receiving messages over a reading and writing pair of Stream objects.

public abstract class StreamMessageHandler : MessageHandlerBase, IJsonRpcMessageHandler, IDisposableObservable, IDisposable, IAsyncDisposable
Inheritance
StreamMessageHandler
Implements
Inherited Members

Constructors

StreamMessageHandler(Stream?, Stream?, IJsonRpcMessageFormatter)

Initializes a new instance of the StreamMessageHandler class.

protected StreamMessageHandler(Stream? sendingStream, Stream? receivingStream, IJsonRpcMessageFormatter formatter)

Parameters

sendingStream Stream

The stream used to transmit messages. May be null.

receivingStream Stream

The stream used to receive messages. May be null.

formatter IJsonRpcMessageFormatter

The formatter to use to serialize JsonRpcMessage instances.

Properties

CanRead

Gets a value indicating whether this message handler has a receiving stream.

public override bool CanRead { get; }

Property Value

bool

CanWrite

Gets a value indicating whether this message handler has a sending stream.

public override bool CanWrite { get; }

Property Value

bool

ReceivingStream

Gets the stream used to receive messages. May be null.

protected Stream? ReceivingStream { get; }

Property Value

Stream

SendingStream

Gets the stream used to transmit messages. May be null.

protected Stream? SendingStream { get; }

Property Value

Stream

Methods

Dispose(bool)

Disposes resources allocated by this instance.

protected override void Dispose(bool disposing)

Parameters

disposing bool

true when being disposed; false when being finalized.

FlushAsync(CancellationToken)

Calls FlushAsync() on the SendingStream, or equivalent sending stream if using an alternate transport.

protected override ValueTask FlushAsync(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

Returns

ValueTask

A Task that completes when the write buffer has been transmitted.