phoenix_pubsub v1.0.2 Phoenix.PubSub.Local
PubSub implementation for handling local-node process groups.
This module is used by Phoenix pubsub adapters to handle
their local node subscriptions and it is usually not accessed
directly. See Phoenix.PubSub.PG2
for an example integration.
Summary
Functions
Sends a message to all subscribers of a topic
Starts the server
Subscribes the pid to the topic
Returns a set of subscribers pids for the given topic
Returns a set of subscribers pids for the given topic with fastlane tuples.
See subscribers/1
for more information
Unsubscribes the pid from the topic
Functions
Sends a message to all subscribers of a topic.
pubsub_server
- The registered server namepool_size
- The size of the pooltopic
- The string topic, for example “users:123”
Examples
iex> broadcast(MyApp.PubSub, 1, self(), "foo")
:ok
iex> broadcast(MyApp.PubSub, 1, :none, "bar")
:ok
Starts the server.
server_name
- The name to register the server under
Subscribes the pid to the topic.
pubsub_server
- The registered server namepool_size
- The size of the poolpid
- The subscriber pidtopic
- The string topic, for example “users:123”opts
- The optional list of options. Supported options only include:link
to link the subscriber to local
Examples
iex> subscribe(MyApp.PubSub, 1, self(), "foo")
:ok
Returns a set of subscribers pids for the given topic.
pubsub_server
- The registered server name or pidtopic
- The string topic, for example “users:123”shard
- The shard, for example1
Examples
iex> subscribers(:pubsub_server, "foo", 1)
[#PID<0.48.0>, #PID<0.49.0>]
Returns a set of subscribers pids for the given topic with fastlane tuples.
See subscribers/1
for more information.