eredis_sub (eredis v2.6.2)
Link to this section Summary
Functions
Make the calling process the controlling process. The controlling process received pubsub-related messages, of which there are three kinds. In each message, the pid refers to the eredis client process.
Link to this section Types
channel/0
Specs
channel() :: binary().
eredis_queue/0
Specs
eredis_queue() :: queue:queue().
sub_args/0
Specs
sub_args() :: [sub_option()].
sub_option/0
Specs
sub_option() ::
eredis:option() |
{max_queue_size, non_neg_integer() | infinity} |
{queue_behaviour, drop | exit}.
Link to this section Functions
ack_message(Client)
Specs
ack_message(Client :: pid()) -> ok.
channels(Client)
controlling_process(Client)
Specs
controlling_process(Client :: pid()) -> ok.
Make the calling process the controlling process. The controlling process received pubsub-related messages, of which there are three kinds. In each message, the pid refers to the eredis client process.
{message, Channel::binary(), Message::binary(), pid()} This is sent for each pubsub message received by the client.
{pmessage, Pattern::binary(), Channel::binary(), Message::binary(), pid()} This is sent for each pattern pubsub message received by the client.
{dropped, NumMessages::integer(), pid()} If the queue reaches the max size as specified in start_link and the behaviour is to drop messages, this message is sent when the queue is flushed.
{subscribed, Channel::binary(), pid()} When using eredis_sub:subscribe(pid()), this message will be sent for each channel Redis aknowledges the subscription. The opposite, 'unsubscribed' is sent when Redis aknowledges removal of a subscription.
{eredis_disconnected, pid()} This is sent when the eredis client is disconnected from redis.
{eredis_connected, pid()} This is sent when the eredis client reconnects to redis after an existing connection was disconnected.
Any message of the form {message, _, _, _} must be acknowledged before any subsequent message of the same form is sent. This prevents the controlling process from being overrun with redis pubsub messages. See ack_message/1.controlling_process(Client, Pid)
Specs
controlling_process(Client :: pid(), Pid :: pid()) -> ok.
controlling_process(Client, Pid, Timeout)
psubscribe(Client, Channels)
Specs
psubscribe(pid(), [channel()]) -> ok.
punsubscribe(Client, Channels)
start_link()
start_link(Args)
Specs
start_link(sub_args()) -> {ok, Pid :: pid()} | {error, Reason :: term()}.
start_link(Host, Port, Password)
start_link(Transport, Host, Port, Password)
start_link(Host, Port, Password, ReconnectSleep, MaxQueueSize, QueueBehaviour)
start_link(Transport, Host, Port, Password, ReconnectSleep, MaxQueueSize, QueueBehaviour)
stop(Pid)
subscribe(Client, Channels)
Specs
subscribe(pid(), [channel()]) -> ok.