(self, connection)
Re-subscribe to any channels and patterns previously subscribed to
Re-subscribe to any channels and patterns previously subscribed to
Re - subscribe to any channels and patterns previously subscribed to
def on_connect(self, connection):
        "Re-subscribe to any channels and patterns previously subscribed to"
        # NOTE: for python3, we can't pass bytestrings as keyword arguments
        # so we need to decode channel/pattern names back to unicode strings
        # before passing them to [p]subscribe.
        if self.channels:
            channels = {}
            for k, v in iteritems(self.channels):
                if not self.decode_responses:
                    k = k.decode(self.encoding, self.encoding_errors)
                channels[k] = v
            self.subscribe(**channels)
        if self.patterns:
            patterns = {}
            for k, v in iteritems(self.patterns):
                if not self.decode_responses:
                    k = k.decode(self.encoding, self.encoding_errors)
                patterns[k] = v
            self.psubscribe(**patterns)
def on_connect ( self , connection ) : # NOTE: for python3, we can't pass bytestrings as keyword arguments # so we need to decode channel/pattern names back to unicode strings # before passing them to [p]subscribe. if self . channels : channels = { } for k , v in iteritems ( self . channels ) : if not self . decode_responses : k = k . decode ( self . encoding , self . encoding_errors ) channels [ k ] = v self . subscribe ( * * channels ) if self . patterns : patterns = { } for k , v in iteritems ( self . patterns ) : if not self . decode_responses : k = k . decode ( self . encoding , self . encoding_errors ) patterns [ k ] = v self . psubscribe ( * * patterns )