View Source Yggdrasil.Subscriber.Adapter.Icon.Message (ICON 2.0 SDK v0.1.6)
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.
Publishes notifications in a channel.
Link to this section Functions
Specs
decode(Yggdrasil.Channel.t(), map()) :: {:ok, [Icon.Schema.Types.EventLog.t()]} | {:error, Icon.Schema.Error.t()}
Decodes an incoming message from the ICON 2.0 websocket.
Specs
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.
Specs
publish(Yggdrasil.Channel.t(), map()) :: Task.t()
Publishes notifications in a channel.