cloudtunes-server/cloudtunes/realtime/connection.py
def on_message(self, msg):
        """
        Delegate `msg` to the right BackendChannel instance.

        :type msg: tornadoredis.client.Message
        """
        if msg.kind == 'psubscribe':
            self.logger.info('subscribed')
            return

        self.logger.debug('got message from redis: channel=%r msg=%r',
                          msg.channel, msg)

        # "user:id:namespace:event"
        bits = msg.channel.split(':', 3)
        namespace = bits[2]  # "namespace"
        event = bits[3]  # "a:b:c"

        if namespace == 'session':
            session_id, namespace, event = event.split(':', 3)
            if session_id != str(self.io.session.session_id):
                self.logger.debug(
                    'not for this session, but for %s, ignoring', session_id)
                return
            else:
                self.logger.debug('yup, it\'s for me')

        channel = self.channels.get(namespace)

        if not channel:
            self.logger.warning(
                'No redis channel "%s" in this user chat. Message: %r',
                namespace, msg
            )
        else:
            self.logger.debug('routing to %s', channel)
            channel.handle(event, msg.body)

        Delegate `msg` to the right BackendChannel instance.

        :type msg: tornadoredis.client.Message
        
Delegate `msg` to the right BackendChannel instance.
Delegate ` msg ` to the right BackendChannel instance .
def on_message(self, msg):
        if msg.kind == 'psubscribe':
            self.logger.info('subscribed')
            return
        self.logger.debug('got message from redis: channel=%r msg=%r',
                          msg.channel, msg)
        bits = msg.channel.split(':', 3)
        namespace = bits[2]  
        event = bits[3]  
        if namespace == 'session':
            session_id, namespace, event = event.split(':', 3)
            if session_id != str(self.io.session.session_id):
                self.logger.debug(
                    'not for this session, but for %s, ignoring', session_id)
                return
            else:
                self.logger.debug('yup, it\'s for me')
        channel = self.channels.get(namespace)
        if not channel:
            self.logger.warning(
                'No redis channel "%s" in this user chat. Message: %r',
                namespace, msg
            )
        else:
            self.logger.debug('routing to %s', channel)
            channel.handle(event, msg.body)
def on_message ( self , msg ) : if msg . kind == 'psubscribe' : self . logger . info ( 'subscribed' ) return self . logger . debug ( 'got message from redis: channel=%r msg=%r' , msg . channel , msg ) bits = msg . channel . split ( ':' , 3 ) namespace = bits [ 2 ] event = bits [ 3 ] if namespace == 'session' : session_id , namespace , event = event . split ( ':' , 3 ) if session_id != str ( self . io . session . session_id ) : self . logger . debug ( 'not for this session, but for %s, ignoring' , session_id ) return else : self . logger . debug ( 'yup, it\'s for me' ) channel = self . channels . get ( namespace ) if not channel : self . logger . warning ( 'No redis channel "%s" in this user chat. Message: %r' , namespace , msg ) else : self . logger . debug ( 'routing to %s' , channel ) channel . handle ( event , msg . body )
Delegate `msg` to the right BackendChannel instance.
Delegate ` msg ` to the right BackendChannel instance .
"""
        Delegate `msg` to the right BackendChannel instance.

        :type msg: tornadoredis.client.Message
        """ # "user:id:namespace:event" # "namespace" # "a:b:c"
self
msg