Interface IMessageCodec<T>
Namespace: Libplanet.Net.Messages
Assembly: Libplanet.Net.dll
Syntax
public interface IMessageCodec<T>
Type Parameters
Name | Description |
---|---|
T |
Methods
| Improve this Doc View SourceDecode(T, Boolean)
Decodes given encoded
into
Message and checks its validity.
Encode(MessageContent, PrivateKey, AppProtocolVersion, BoundPeer, DateTimeOffset, Byte[])
Declaration
Message Decode(T encoded, bool reply)
Parameters
Type | Name | Description |
---|---|---|
T | encoded | A |
Boolean | reply | A flag to express whether the target is a reply of other message. |
Returns
Type | Description |
---|---|
Message | A Message parsed from |
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown when empty |
InvalidMessageSignatureException | Thrown when the signer of
|
Encode(MessageContent, PrivateKey, AppProtocolVersion, BoundPeer, DateTimeOffset, Byte[])
Encodes the message to privateKey
and peer
.
Declaration
T Encode(MessageContent content, PrivateKey privateKey, AppProtocolVersion appProtocolVersion, BoundPeer peer, DateTimeOffset timestamp, byte[] identity)
Parameters
Type | Name | Description |
---|---|---|
MessageContent | content | The message body to encode. |
PrivateKey | privateKey | The PrivateKey to sign the encoded message. |
AppProtocolVersion | appProtocolVersion | The AppProtocolVersion of the transport layer. |
BoundPeer | peer | The BoundPeer-typed representation of the transport layer. AsPeer |
DateTimeOffset | timestamp | The DateTimeOffset of the time
|
Byte[] | identity | The byte array identifies the message to match between message and its respond used in NetMQ. |
Returns
Type | Description |
---|---|
T | A |
Exceptions
Type | Condition |
---|---|
InvalidCredentialException | Thrown when |