def on_message(self, data):
        try:
            data = json_decode(data)
        except __HOLE__:
            self._die(log_message='Unable to decode json')

        if type(data).__name__ != 'dict' or 'method' not in data:
            self._die(log_message='data is not a dict or no key "method" in data dict found. Data: %s' % data)

        # define available methods
        methods = {
           'register_myself_as_map_participant': self._register_myself_as_map_participant,
           'update_component_pos': self._update_component_pos,
           'update_component_title': self._update_component_title,
           'add_components_offset_except_one': self._add_components_offset_except_one,
           'add_component': self._add_component,
           'delete_component': self._delete_component,
        }

        # call method
        try:
            method = methods.get(data['method'], None)
            method(data)
        except TypeError:
            self._die('Unknown method "%s" called' % data['method'])
dataset/ETHPy150Open ierror/BeautifulMind.io/beautifulmind/mindmaptornado/handlers.py/MindmapWebSocketHandler.on_message