Redix.PubSub.subscribe
You're seeing just the function
subscribe
, go back to Redix.PubSub module for more information.
Specs
subscribe(connection(), String.t() | [String.t()], subscriber()) :: {:ok, reference()}
Subscribes subscriber
to the given channel or list of channels.
Subscribes subscriber
(which can be anything that can be passed to send/2
)
to channels
, which can be a single channel or a list of channels.
For each of the channels in channels
which subscriber
successfully
subscribes to, a message will be sent to subscriber
with this form:
{:redix_pubsub, pid, subscription_ref, :subscribed, %{channel: channel}}
See the documentation for Redix.PubSub
for more information about the format
of messages.
Examples
iex> Redix.PubSub.subscribe(conn, ["foo", "bar"], self())
{:ok, subscription_ref}
iex> flush()
{:redix_pubsub, ^conn, ^subscription_ref, :subscribed, %{channel: "foo"}}
{:redix_pubsub, ^conn, ^subscription_ref, :subscribed, %{channel: "bar"}}
:ok