Yggdrasil v5.0.0 Yggdrasil.Publisher.Adapter.Bridge View Source
Yggdrasil bridge publisher adapter. The name of the channel can be any arbitrary term e.g:
First we subscribe to a channel:
iex> channel = [name: [name: "remote_channel"], adapter: :bridge]
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
Link to this section Functions
Link to this function
child_spec(init_arg) View Source
Returns a specification to start this module under a supervisor.
See Supervisor
.
Link to this function
publish(publisher, channel, message, options \\ [])
View Source
publish(publisher, channel, message, options \\ [])
View Source
publish(GenServer.server(), Yggdrasil.Channel.t(), term(), Keyword.t()) ::
:ok | {:error, term()}
publish(GenServer.server(), Yggdrasil.Channel.t(), term(), Keyword.t()) ::
:ok | {:error, term()}
publish(GenServer.server(), Yggdrasil.Channel.t(), term(), Keyword.t()) :: :ok | {:error, term()}
publish(GenServer.server(), Yggdrasil.Channel.t(), term(), Keyword.t()) :: :ok | {:error, term()}
Publishes a message
in a channel
using a publisher
with some options
.
Link to this function
start_link(namespace, options \\ [])
View Source
start_link(namespace, options \\ [])
View Source
start_link(atom(), GenServer.options()) :: GenServer.options()
start_link(atom(), GenServer.options()) :: GenServer.options()
Starts a publisher adapter for an adapter given a namespace
.
Optionally, receives GenServer
options
.