Dela via


MessagePackFormatter Class

Definition

Serializes JSON-RPC messages using MessagePack (a fast, compact binary format).

public class MessagePackFormatter : IDisposable, StreamJsonRpc.IJsonRpcInstanceContainer, StreamJsonRpc.IJsonRpcMessageFactory, StreamJsonRpc.IJsonRpcMessageFormatter, StreamJsonRpc.Reflection.IJsonRpcFormatterState, StreamJsonRpc.Reflection.IJsonRpcFormatterTracingCallbacks
public class MessagePackFormatter : StreamJsonRpc.FormatterBase, StreamJsonRpc.IJsonRpcMessageFactory, StreamJsonRpc.IJsonRpcMessageFormatter, StreamJsonRpc.Reflection.IJsonRpcFormatterTracingCallbacks
public class MessagePackFormatter : IDisposable, StreamJsonRpc.IJsonRpcInstanceContainer, StreamJsonRpc.IJsonRpcMessageFormatter, StreamJsonRpc.Reflection.IJsonRpcFormatterState, StreamJsonRpc.Reflection.IJsonRpcFormatterTracingCallbacks
type MessagePackFormatter = class
    interface IJsonRpcMessageFormatter
    interface IJsonRpcInstanceContainer
    interface IJsonRpcFormatterState
    interface IJsonRpcFormatterTracingCallbacks
    interface IJsonRpcMessageFactory
    interface IDisposable
type MessagePackFormatter = class
    inherit FormatterBase
    interface IJsonRpcMessageFormatter
    interface IJsonRpcFormatterTracingCallbacks
    interface IJsonRpcMessageFactory
type MessagePackFormatter = class
    interface IJsonRpcMessageFormatter
    interface IJsonRpcInstanceContainer
    interface IJsonRpcFormatterState
    interface IJsonRpcFormatterTracingCallbacks
    interface IDisposable
Public Class MessagePackFormatter
Implements IDisposable, IJsonRpcFormatterState, IJsonRpcFormatterTracingCallbacks, IJsonRpcInstanceContainer, IJsonRpcMessageFactory, IJsonRpcMessageFormatter
Public Class MessagePackFormatter
Inherits FormatterBase
Implements IJsonRpcFormatterTracingCallbacks, IJsonRpcMessageFactory, IJsonRpcMessageFormatter
Public Class MessagePackFormatter
Implements IDisposable, IJsonRpcFormatterState, IJsonRpcFormatterTracingCallbacks, IJsonRpcInstanceContainer, IJsonRpcMessageFormatter
Inheritance
MessagePackFormatter
Inheritance
MessagePackFormatter
Implements

Remarks

The MessagePack implementation used here comes from https://github.com/neuecc/MessagePack-CSharp. The README on that project site describes use cases and its performance compared to alternative .NET MessagePack implementations and this one appears to be the best by far.

Constructors

MessagePackFormatter()

Initializes a new instance of the MessagePackFormatter class.

Properties

ApplicableMethodAttributeOnDeserializingMethod

Gets the JsonRpcMethodAttribute that is present on the method that may be invoked to serve the incoming request, when applicable.

(Inherited from FormatterBase)
DefaultUserDataSerializationOptions

Gets the default MessagePack.MessagePackSerializerOptions used for user data (arguments, return values and errors) in RPC calls prior to any call to SetMessagePackSerializerOptions(MessagePackSerializerOptions).

DuplexPipeTracker

Gets the helper for marshaling pipes as RPC method arguments.

(Inherited from FormatterBase)
EnumerableTracker

Gets the helper for marshaling IAsyncEnumerable<T> in RPC method arguments or return values.

(Inherited from FormatterBase)
FormatterProgressTracker

Gets the MessageFormatterProgressTracker instance containing useful methods to help on the implementation of message formatters.

(Inherited from FormatterBase)
JsonRpc

Gets the JsonRpc that is associated with this formatter.

(Inherited from FormatterBase)
MultiplexingStream

Gets or sets the MultiplexingStream that may be used to establish out of band communication (e.g. marshal IDuplexPipe arguments).

Methods

Deserialize(ReadOnlySequence<Byte>)

Deserializes a JsonRpcMessage.

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

Dispose() (Inherited from FormatterBase)
Dispose(Boolean)

Disposes managed and native resources held by this instance.

Dispose(Boolean)

Disposes managed and native resources held by this instance.

(Inherited from FormatterBase)
GetJsonText(JsonRpcMessage)

Gets a JSON representation for a given message for tracing purposes.

Serialize(IBufferWriter<Byte>, JsonRpcMessage)

Serializes a JsonRpcMessage.

SetMessagePackSerializerOptions(MessagePackSerializerOptions)

Sets the MessagePack.MessagePackSerializerOptions to use for serialization of user data.

TrackDeserialization(JsonRpcMessage, ReadOnlySpan<ParameterInfo>)

Sets up state to track deserialization of a message.

(Inherited from FormatterBase)
TrackSerialization(JsonRpcMessage)

Sets up state to track serialization of a message.

(Inherited from FormatterBase)

Explicit Interface Implementations

IJsonRpcFormatterState.DeserializingMessageWithId

Gets the ID of the response currently being deserialized.

IJsonRpcFormatterState.DeserializingMessageWithId

Gets the ID of the response currently being deserialized.

(Inherited from FormatterBase)
IJsonRpcFormatterState.SerializingMessageWithId

Gets the id of the request or response currently being serialized.

IJsonRpcFormatterState.SerializingMessageWithId

Gets the id of the request or response currently being serialized.

(Inherited from FormatterBase)
IJsonRpcFormatterState.SerializingRequest

Gets a value indicating whether a JsonRpcRequest is being serialized.

IJsonRpcFormatterState.SerializingRequest

Gets a value indicating whether a JsonRpcRequest is being serialized.

(Inherited from FormatterBase)
IJsonRpcFormatterTracingCallbacks.OnSerializationComplete(JsonRpcMessage, ReadOnlySequence<Byte>)
IJsonRpcInstanceContainer.Rpc

Sets the JsonRpc instance.

IJsonRpcInstanceContainer.Rpc

Sets the JsonRpc instance.

(Inherited from FormatterBase)
IJsonRpcMessageFactory.CreateErrorMessage()

Creates an instance of JsonRpcError suitable for transmission over the IJsonRpcMessageFormatter.

IJsonRpcMessageFactory.CreateRequestMessage()

Creates an instance of JsonRpcRequest suitable for transmission over the IJsonRpcMessageFormatter.

IJsonRpcMessageFactory.CreateResultMessage()

Creates an instance of JsonRpcResult suitable for transmission over the IJsonRpcMessageFormatter.

Applies to