#NEWLINE# def on_message( self , data ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# data = json_decode ( data ) #NEWLINE# #UNINDENT# except ValueError : #NEWLINE# #INDENT# self . _die ( log_message = 'Unable to decode json' ) #NEWLINE# #UNINDENT# if ( ( type ( data ) . __name__ != 'dict' ) or ( 'method' not in data ) ) : #NEWLINE# #INDENT# self . _die ( log_message = ( 'data is not a dict or no key "method" in data dict found. Data: %s' % data ) ) #NEWLINE# #UNINDENT# methods = { #NEWLINE# #INDENT# 'register_myself_as_map_participant' : self . _register_myself_as_map_participant , #NEWLINE# 'update_component_pos' : self . _update_component_pos , #NEWLINE# 'update_component_title' : self . _update_component_title , #NEWLINE# 'add_components_offset_except_one' : self . _add_components_offset_except_one , #NEWLINE# 'add_component' : self . _add_component , #NEWLINE# 'delete_component' : self . _delete_component , #NEWLINE# #UNINDENT# } #NEWLINE# try : #NEWLINE# #INDENT# method = methods . get ( data [ 'method' ] , None ) #NEWLINE# method ( data ) #NEWLINE# #UNINDENT# except TypeError : #NEWLINE# #INDENT# self . _die ( ( 'Unknown method "%s" called' % data [ 'method' ] ) )