Package redis :: Module client :: Class PubSub
[frames] | no frames]

Class PubSub

source code

object --+
         |
        PubSub

PubSub provides publish, subscribe and listen support to Redis channels.

After subscribing to one or more channels, the listen() method will block until a message arrives on one of the subscribed channels. That message will be returned and it's safe to start listening again.

Instance Methods
 
__init__(self, connection_pool, shard_hint=None)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
__del__(self) source code
 
reset(self) source code
 
close(self) source code
 
execute_command(self, *args, **kwargs)
Execute a publish/subscribe command
source code
 
parse_response(self)
Parse the response from a publish/subscribe command
source code
 
psubscribe(self, patterns)
Subscribe to all channels matching any pattern in ``patterns``
source code
 
punsubscribe(self, patterns=[])
Unsubscribe from any channel matching any pattern in ``patterns``.
source code
 
subscribe(self, channels)
Subscribe to ``channels``, waiting for messages to be published
source code
 
unsubscribe(self, channels=[])
Unsubscribe from ``channels``.
source code
 
listen(self)
Listen for messages on channels this client has been subscribed to
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties

Inherited from object: __class__

Method Details

__init__(self, connection_pool, shard_hint=None)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

punsubscribe(self, patterns=[])

source code 

Unsubscribe from any channel matching any pattern in ``patterns``. If empty, unsubscribe from all channels.

unsubscribe(self, channels=[])

source code 

Unsubscribe from ``channels``. If empty, unsubscribe from all channels