Module ebus_ps

This is an Erlang clone of the original Phoenix.PubSub module.

References

Description

This is an Erlang clone of the original Phoenix.PubSub module. Copyright (c) 2014 Chris McCord

Data Types

options()

options() = ebus_ps_local:options()

Function Index

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/3Equivalent 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.

Function Details

broadcast/3

broadcast(Server::atom(), Topic::binary(), Msg::term()) -> ok | {error, term()}

Broadcasts message on given topic.

broadcast_from/4

broadcast_from(Server::atom(), FromPid::pid(), Topic::binary(), Msg::term()) -> ok | {error, term()}

Broadcasts message to all but FromPid on given topic.

list/1

list(Server::atom()) -> [binary()]

Returns the topic list. This is an expensive and private operation. DO NOT USE IT IN PROD.

subscribe/3

subscribe(Server, Pid, Topic) -> any()

Equivalent to subscribe(Server, Pid, Topic, []).

subscribe/4

subscribe(Server::atom(), Pid::pid(), Topic::binary(), Opts::options()) -> ok | {error, term()}

Subscribes the pid to the PubSub adapter's topic.

Options:

subscribers/2

subscribers(Server::atom(), Topic::binary()) -> [pid()]

Returns a set of subscribers pids for the given topic.

Example:

  > subscribers(pubsub_server, <<"foo">>).
  [<0.48.0>, <0.49.0>]

unsubscribe/3

unsubscribe(Server::atom(), Pid::pid(), Topic::binary()) -> ok | {error, term()}

Unsubscribes the pid from the PubSub adapter's topic.


Generated by EDoc