def _on_message(self, sender, message):
    '\n        Message receiving callback\n\n        :param sender: Message sender\n        :param message: The message\n        '
    logging.info('Received message {0} from {1}'.format(message, sender))
    if (len(message) < 3):
        logging.info('Message is too short to be something!')
    elif (message[:1] == b'\x02'):
        try:
            logging.info('Received ack, deleting message from sent')
            id = int.from_bytes(message[1:3], 'big')
            if (id in self.__sent_messages.keys()):
                self.__sent_messages.pop(id)
        except KeyError:
            logging.error('Message was already deleted from republish')
    else:
        logging.info('Received message, sending ack...')
        ack_message = (b'\x02' + message[1:3])
        self.__connection.publish(b'ack', sender.decode(), ack_message)
        self.__callback(self.__callback_object, sender, message[3:])
Message receiving callback

:param sender: Message sender
:param message: The message
def _on_message(self, sender, message):
    '\n        Message receiving callback\n\n        :param sender: Message sender\n        :param message: The message\n        '
    logging.info('Received message {0} from {1}'.format(message, sender))
    if (len(message) < 3):
        logging.info('Message is too short to be something!')
    elif (message[:1] == b'\x02'):
        try:
            logging.info('Received ack, deleting message from sent')
            id = int.from_bytes(message[1:3], 'big')
            if (id in self.__sent_messages.keys()):
                self.__sent_messages.pop(id)
        except KeyError:
            logging.error('Message was already deleted from republish')
    else:
        logging.info('Received message, sending ack...')
        ack_message = (b'\x02' + message[1:3])
        self.__connection.publish(b'ack', sender.decode(), ack_message)
        self.__callback(self.__callback_object, sender, message[3:])