def messageReceived(self, message):
        try:
            msgtype, topic, payload = self._messageSplit(message)
        except __HOLE__:
            log.msg('invalid message received <%s>' % message)
            return

        if topic not in self.channels:
            return

        if topic in self.endpoints:
            session = self.endpoints[topic]

            if msgtype == 'uns':
                del self.endpoints[topic]
                session._close()
            elif msgtype == 'msg':
                if payload:
                    session.messageReceived(payload)
        else:
            if msgtype == 'sub':

                session_args = (self.channels[topic], self.session.server,
                                self, topic)
                session = self.session.server.create_session(
                                     session_id=None, register=False,
                                     session_factory=(MultiplexChannelSession,
                                                      session_args, {}))
                session.set_handler(self.handler)
                session.verify_state()

                self.endpoints[topic] = session
dataset/ETHPy150Open flaviogrossi/sockjs-cyclone/sockjs/cyclone/conn.py/MultiplexConnection.messageReceived