Phoenix.PubSub module.
References
Phoenix.PubSub module.
Copyright (c) 2014 Chris McCord
options() = ebus_ps_local:options()
| broadcast/3 | Broadcasts message on given topic. |
| broadcast_from/4 |
Broadcasts message to all but FromPid on given topic. |
| list/1 | Returns the topic list. |
| subscribe/3 | Equivalent to subscribe(Server, Pid, Topic, []). |
| subscribe/4 | Subscribes the pid to the PubSub adapter's topic. |
| subscribers/2 | Returns a set of subscribers pids for the given topic. |
| unsubscribe/3 | Unsubscribes the pid from the PubSub adapter's topic. |
broadcast(Server::atom(), Topic::binary(), Msg::term()) -> ok | {error, term()}
Broadcasts message on given topic.
broadcast_from(Server::atom(), FromPid::pid(), Topic::binary(), Msg::term()) -> ok | {error, term()}
Broadcasts message to all but FromPid on given topic.
list(Server::atom()) -> [binary()]
Returns the topic list. This is an expensive and private operation. DO NOT USE IT IN PROD.
subscribe(Server, Pid, Topic) -> any()
Equivalent to subscribe(Server, Pid, Topic, []).
subscribe(Server::atom(), Pid::pid(), Topic::binary(), Opts::options()) -> ok | {error, term()}
Subscribes the pid to the PubSub adapter's topic.
Server: The Pid registered name of the server.Pid: The subscriber pid to receive pubsub messages.Topic: The topic to subscribe to, ie: "users:123".Opts: The optional list of options. See below.link: links the subscriber to the pubsub adapter.fastlane: Provides a fastlane path for the broadcasts for
broadcast() events. The fastlane process is notified of a cached
message instead of the normal subscriber. Fastlane handlers must
implement fastlane/1 callbacks which accepts a broadcast() struct
and returns a fastlaned format for the handler. For example: ebus_ps:subscribe(
my_pubsub_server, self(), <<"topic1">>,
[{fastlane, {FastPid, my_serializer, [<<"event1">>]}).`
subscribers(Server::atom(), Topic::binary()) -> [pid()]
Returns a set of subscribers pids for the given topic.
Server: The registered server name or pid.Topic: The string topic, for example <<"users:123">>.Example:
> subscribers(pubsub_server, <<"foo">>). [<0.48.0>, <0.49.0>]
unsubscribe(Server::atom(), Pid::pid(), Topic::binary()) -> ok | {error, term()}
Unsubscribes the pid from the PubSub adapter's topic.
Generated by EDoc