Show / Hide Table of Contents

Class NetMQMessageCodec

Inheritance
Object
NetMQMessageCodec
Implements
IMessageCodec<NetMQMessage>
Namespace: Libplanet.Net.Messages
Assembly: Libplanet.dll
Syntax
public class NetMQMessageCodec : object, IMessageCodec<NetMQMessage>

Constructors

| Improve this Doc View Source

NetMQMessageCodec()

Declaration
public NetMQMessageCodec()

Methods

| Improve this Doc View Source

Decode(NetMQMessage, Boolean, Action<Byte[], Peer, AppProtocolVersion>, Nullable<TimeSpan>)

Decodes given -typed encoded into Message and checks its validity. Encode(Message, PrivateKey, Peer, DateTimeOffset, AppProtocolVersion)

Declaration
public Message Decode(NetMQMessage encoded, bool reply, Action<byte[], Peer, AppProtocolVersion> appProtocolVersionValidator, TimeSpan? lifetime)
Parameters
Type Name Description
NetMQMessage encoded
Boolean reply

A flag to express whether the target is a reply of other message.

Libplanet.Action<Byte[], Peer, AppProtocolVersion> appProtocolVersionValidator

The delegate validates the app protocol version of the message.

Nullable<TimeSpan> lifetime

The lifetime of a message. Messages generated before this value from the current time are ignored. If null is given, messages will not be ignored by its timestamp.

Returns
Type Description
Message

A Message parsed from encoded.

Exceptions
Type Condition
Libplanet.Net.DifferentAppProtocolVersionException

Thrown when local version does not match with given encoded's by given appProtocolVersionValidator.

InvalidMessageException

Thrown when given encoded's signer is invalid.

| Improve this Doc View Source

Encode(Message, PrivateKey, Peer, DateTimeOffset, AppProtocolVersion)

Encodes the message to -typed instance with given privateKey, peer and version.

Declaration
public NetMQMessage Encode(Message message, PrivateKey privateKey, Peer peer, DateTimeOffset timestamp, AppProtocolVersion version)
Parameters
Type Name Description
Message message

A message to encode.

PrivateKey privateKey

A PrivateKey to sign message.

Peer peer

Peer-typed representation of the sender's transport layer. AsPeer

DateTimeOffset timestamp

The of the message is created.

AppProtocolVersion version

AppProtocolVersion-typed version of the transport layer.

Returns
Type Description
NetMQMessage

A containing the signed Message.

Implements

IMessageCodec<T>
  • Improve this Doc
  • View Source
In This Article
Back to top Copyright © 2018–2021 Planetarium