Class NetMQMessageCodec
Implements
Namespace: Libplanet.Net.Messages
Assembly: Libplanet.dll
Syntax
public class NetMQMessageCodec : object, IMessageCodec<NetMQMessage>
Constructors
| Improve this Doc View SourceNetMQMessageCodec()
Declaration
public NetMQMessageCodec()
Methods
| Improve this Doc View SourceDecode(NetMQMessage, Boolean, Action<Byte[], Peer, AppProtocolVersion>, Nullable<TimeSpan>)
Decodes given 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 |
Returns
| Type | Description |
|---|---|
| Message | A Message parsed from |
Exceptions
| Type | Condition |
|---|---|
| Libplanet.Net.DifferentAppProtocolVersionException | Thrown when
local version does not match with given |
| InvalidMessageException | Thrown when given |
Encode(Message, PrivateKey, Peer, DateTimeOffset, AppProtocolVersion)
Encodes the message to 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 |
| AppProtocolVersion | version | AppProtocolVersion-typed version of the transport layer. |
Returns
| Type | Description |
|---|---|
| NetMQMessage | A |