(From the Redis.io documentation):
implement the Publish/Subscribe messaging paradigm where (citing Wikipedia)
senders (publishers) are not programmed to send their messages to specific
receivers (subscribers). Rather, published messages are characterized into
channels, without knowledge of what (if any) subscribers there may be.
Subscribers express interest in one or more channels, and only receive messages
that are of interest, without knowledge of what (if any) publishers there are.
The redisMonitorChannels
function may be called repeatedly in an
event loop to service messages on all subscribed channels. When a message
is received, the redisMonitorChannels
function will attempt to
evaluate a callback function with same name as the channel, with the message
as its single argument. If no such function can be found, the message is
returned. See the help page for redisGetResponse
for a description
of the message format.
WARNING: The redisMonitorChannels
function blocks indefinitely until a
message is received.
Use the lower-level listen
context method to simply poll channels
for messages without evaluating function callbacks.