yggdrasil_ethereum v0.1.0 Yggdrasil.Subscriber.Adapter.Ethereum View Source
Yggdrasil subscriber adapter for Ethereum. The name of the channel must be
a tuple with the EthEvent
module and its parameters or a list of these
tuples for composable events e.g:
Subscription to channel:
iex(1)> channel_name = {Balance, [address: "0x1234..."]}
iex(2)> channel = %Yggdrasil.Channel{name: channel_name, adapter: :ethereum}}
iex(3)> Yggdrasil.subscribe(channel)
:ok
iex(4)> flush()
{:Y_CONNECTED, %Yggdrasil.Channel{name: {Balance, (...)}, (...)}}
And when a subscriber receives a message:
iex(5)> flush()
{:Y_EVENT, %Yggdrasil.Channel{name: {Balance, (...)}}, %Balance{...}}
The subscriber can also unsubscribe from the channel:
iex(6)> Yggdrasil.unsubscribe(channel)
:ok
iex(7)> flush()
{:Y_DISCONNECTED, %Yggdrasil.Channel{name: {Balance, (...)}}}
Link to this section Summary
Functions
Returns a specification to start this module under a supervisor
Link to this section Functions
Returns a specification to start this module under a supervisor.
See Supervisor
.