code: def _on_receive(self, client, userdata, message):
          
  
          topic = message.topic
          encoded = message.payload
  
          try:
              packet = json.loads(encoded)
          except ValueError:
              self._logger.warn("Could not decode json packet: %s", encoded)
              return
  
          try:
              seq = packet['sequence']
              message_data = packet['message']
          except KeyError:
              self._logger.warn("Message received did not have required sequence and message keys: %s", packet)
              return
  
          # If we received a packet that does not fit into a queue, check our wildcard
          # queues
          if topic not in self.queues:
              found = False
              for _, regex, callback, ordered in self.wildcard_queues:
                  if regex.match(topic):
                      self.queues[topic] = PacketQueue(0, callback, ordered)
                      found = True
                      break
  
              if not found:
                  self._logger.warn("Received message for unknown topic: %s", topic)
                  return
  
          self.queues[topic].receive(seq, [seq, topic, message_data])
docs: Callback called whenever we receive a message on a subscribed topic
  
          Args:
              client (string): The client id of the client receiving the message
              userdata (string): Any user data set with the underlying MQTT client
              message (object): The mesage with a topic and payload.