Share via


MessageHandlerBase Class

Definition

An abstract base class for for sending and receiving messages.

public abstract class MessageHandlerBase : IDisposable, Microsoft.IDisposableObservable, StreamJsonRpc.IJsonRpcMessageHandler
public abstract class MessageHandlerBase : IDisposable, Microsoft.IDisposableObservable, Microsoft.VisualStudio.Threading.IAsyncDisposable, StreamJsonRpc.IJsonRpcMessageHandler
type MessageHandlerBase = class
    interface IJsonRpcMessageHandler
    interface IDisposableObservable
    interface IDisposable
type MessageHandlerBase = class
    interface IJsonRpcMessageHandler
    interface IDisposableObservable
    interface IDisposable
    interface IAsyncDisposable
Public MustInherit Class MessageHandlerBase
Implements IDisposable, IDisposableObservable, IJsonRpcMessageHandler
Public MustInherit Class MessageHandlerBase
Implements IAsyncDisposable, IDisposable, IDisposableObservable, IJsonRpcMessageHandler
Inheritance
MessageHandlerBase
Derived
Implements

Remarks

This class and its derivatives are safe to call from any thread. Calls to WriteAsync(JsonRpcMessage, CancellationToken) are protected by a semaphore to guarantee message integrity and may be made from any thread. The caller must take care to call ReadAsync(CancellationToken) sequentially.

Constructors

MessageHandlerBase(IJsonRpcMessageFormatter)

Initializes a new instance of the MessageHandlerBase class.

Properties

CanRead

Gets a value indicating whether this message handler can receive messages.

CanWrite

Gets a value indicating whether this message handler can send messages.

DisposalToken

Gets a token that is canceled when this instance is disposed.

Formatter

Gets the formatter used for message serialization.

Methods

Dispose()
Obsolete.

Disposes this instance, and cancels any pending read or write operations.

Dispose(Boolean)

Disposes resources allocated by this instance that are common to both reading and writing.

DisposeAsync()

Disposes this instance, and cancels any pending read or write operations.

DisposeReader()

Disposes resources allocated by this instance that are used for reading (not writing).

DisposeWriter()

Disposes resources allocated by this instance that are used for writing (not reading).

FlushAsync(CancellationToken)

Ensures that all messages transmitted up to this point are en route to their destination, rather than sitting in some local buffer.

ReadAsync(CancellationToken)

Reads a distinct and complete message from the transport, waiting for one if necessary.

ReadCoreAsync(CancellationToken)

Reads a distinct and complete message, waiting for one if necessary.

WriteAsync(JsonRpcMessage, CancellationToken)

Writes a message to the transport and flushes.

WriteCoreAsync(JsonRpcMessage, CancellationToken)

Writes a message.

Explicit Interface Implementations

IDisposableObservable.IsDisposed

Gets a value indicating whether this instance has been disposed.

Applies to