poa_backend v0.1.0 POABackend.Protocol.Message View Source
The message received from the Agent (inspired in Plug.Conn
).
This module defines the Message received from the Agent and the main functions in order to work with it.
Message Fields
agent_id
- The Agent Id which sent the message to the backend.data_type
- The kind of data the message is carring. For now onlyethereum_metric
type is defined.message_type
- This is the message type according to the custom protocol. Onlydata
andbye
are defined for nowassigns
- Shared user data as a mapdata
- The message payloda. It is a map
Link to this section Summary
Functions
Assigns a value to a key in the connection
Returns a new Message Struct
Returns a new Message Struct initialized. The params in order are: agent_id, data_type, message_type and data
Link to this section Types
The Message struct.
That keeps all the message data and metadata
Link to this section Functions
Assigns a value to a key in the connection.
Examples
iex> alias POABackend.Protocol.Message
iex> message = Message.new()
iex> message.assigns[:hello]
nil
iex> message = Message.assign(message, :hello, :world)
iex> message.assigns[:hello]
:world
Returns a new Message Struct
Returns a new Message Struct initialized. The params in order are: agent_id, data_type, message_type and data