parameters: (self, message)
docstring: Handles new messages on the socket.
docstring_summary: Handles new messages on the socket.
docstring_tokens: Handles new messages on the socket .
function: def on_message(self, message):
          """ Handles new messages on the socket."""
          logger.debug("Received message of type {}: {}".format(type(message), message))
  
          try:
              msg = json.loads(message)
          except Exception as e:
              logger.error('Failed to decode incoming message: {}'.format(e))
              return
  
          if msg.get("type") == "geometry":
              requests = msg.get("data")
              if not requests:
                  logger.error('Message contained no data: {}'.format(msg))
  
              logger.debug('Handling geometry request: {}'.format(msg))
  
              for req in requests:
                  byte_message = yield self.get_requested_geometry(req)
                  self.maybe_write_message(byte_message, binary=True)
function_tokens: def on_message ( self , message ) : logger . debug ( "Received message of type {}: {}" . format ( type ( message ) , message ) ) try : msg = json . loads ( message ) except Exception as e : logger . error ( 'Failed to decode incoming message: {}' . format ( e ) ) return if msg . get ( "type" ) == "geometry" : requests = msg . get ( "data" ) if not requests : logger . error ( 'Message contained no data: {}' . format ( msg ) ) logger . debug ( 'Handling geometry request: {}' . format ( msg ) ) for req in requests : byte_message = yield self . get_requested_geometry ( req ) self . maybe_write_message ( byte_message , binary = True )