def on_message(self, ws, reply, *args):
log.debug("<STR_LIT>" % str(reply))<EOL>data = {}<EOL>try:<EOL><INDENT>data = json.loads(reply, strict=False)<EOL><DEDENT>except ValueError:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if data.get("<STR_LIT>") == "<STR_LIT>":<EOL><INDENT>id = data["<STR_LIT>"][<NUM_LIT:0>]<EOL>if id >= len(self.__events__):<EOL><INDENT>log.critical("<STR_LIT>" + str(data))<EOL>return<EOL><DEDENT>if id == self.__events__.index("<STR_LIT>"):<EOL><INDENT>for notice in data["<STR_LIT>"][<NUM_LIT:1>]:<EOL><INDENT>try:<EOL><INDENT>if "<STR_LIT:id>" in notice:<EOL><INDENT>self.process_notice(notice)<EOL><DEDENT>else:<EOL><INDENT>for obj in notice:<EOL><INDENT>if "<STR_LIT:id>" in obj:<EOL><INDENT>self.process_notice(obj)<EOL><DEDENT><DEDENT><DEDENT><DEDENT>except Exception as e:<EOL><INDENT>log.critical(<EOL>"<STR_LIT>".format(<EOL>str(e), traceback.format_exc<EOL>)<EOL>)<EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>try:<EOL><INDENT>callbackname = self.__events__[id]<EOL>log.info("<STR_LIT>" % callbackname)<EOL>[getattr(self.events, callbackname)(x) for x in data["<STR_LIT>"][<NUM_LIT:1>]]<EOL><DEDENT>except Exception as e:<EOL><INDENT>log.critical(<EOL>"<STR_LIT>".format(<EOL>callbackname, str(e), traceback.format_exc()<EOL>)<EOL>)<EOL><DEDENT><DEDENT><DEDENT>
This method is called by the websocket connection on every
            message that is received. If we receive a ``notice``, we
            hand over post-processing and signalling of events to
            ``process_notice``.