View Source Yggdrasil.Subscriber.Adapter.Icon.Message (ICON 2.0 SDK v0.2.3)
This module defines functions to deal with ICON 2.0 websocket messages.
When a connection is established with the ICON 2.0 websocket, we need to send
a text
frame with a JSON payload to state our intention. There are two
channels:
:block
for receiving both ticks on every block and event logs specific to the events we're filtering.:event
for receiving updates for a specific event log.
Link to this section Summary
Functions
Decodes an incoming message from the ICON 2.0 websocket.
Encodes a request for the ICON 2.0 websocket. It receives the height
and
the channel
to build the request.
Link to this section Types
@type t() :: Icon.Schema.Types.Block.Tick.t() | Icon.Schema.Types.EventLog.t()
Message.
Link to this section Functions
@spec decode(Yggdrasil.Channel.t(), map()) :: :ok | {:ok, [t()]} | {:error, Icon.Schema.Error.t()}
Decodes an incoming message from the ICON 2.0 websocket.
@spec encode(pos_integer(), Yggdrasil.Channel.t()) :: WebSockex.frame() | no_return()
Encodes a request for the ICON 2.0 websocket. It receives the height
and
the channel
to build the request.