View Source Yggdrasil.Publisher.Adapter.Elixir (Yggdrasil v6.0.2)

Yggdrasil publisher adapter for Elixir. The name of the channel can be any arbitrary term e.g:

First we subscribe to a channel:

iex> channel = [name: "elixir_channel"]
iex> Yggdrasil.subscribe(channel)
:ok
iex> flush()
{:Y_CONNECTED, ...}

Once connected, you can publish a message in that channel:

iex> Yggdrasil.publish(channel, "foo")
:ok

And the subscriber should receive the message:

iex> flush()
{:Y_EVENT, ..., "foo"}

Additionally, the subscriber can also unsubscribe from the channel:

iex> Yggdrasil.unsubscribe(channel)
:ok
iex> flush()
{:Y_DISCONNECTED, ...}

Link to this section Summary

Functions

Returns a specification to start this module under a supervisor.

Publishes a message in a channel using a publisher.

Starts a publisher adapter for an adapter given a namespace. Optionally, receives GenServer options.

Link to this section Functions

Returns a specification to start this module under a supervisor.

See Supervisor.

Link to this function

publish(publisher, channel, message, options \\ [])

View Source

Publishes a message in a channel using a publisher.

Link to this function

start_link(namespace, options \\ [])

View Source

Starts a publisher adapter for an adapter given a namespace. Optionally, receives GenServer options.