Exemple #1
0
    def on_message(self, msg):
        msg = json.loads(msg)
        tp = msg.get('type')
        payload = msg.get('payload')
        name = msg.get('protocol')

        protocol = self.get_protocol(name)
        if protocol is not None:
            try:
                protocol.dispatch(tp, payload, msg)
            except Exception as e:
                log.exception(str(e))
        else:
            log.warning("Can't find protocol %s"%name)
Exemple #2
0
 def on_message(self, msg):
     self.commands.put_nowait(json.loads(msg))
Exemple #3
0
 def on_message(self, msg):
     self.commands.put_nowait(json.loads(msg))