Example #1
0
    def _deserialize(self, data_bytes) -> Message:
        message_state = json.loads(data_bytes.decode(encoding=ENCODING))
        self._get_logger().debug(
            'Parsing message: {}...'.format(message_state))

        message_class = TYPE_TO_CLASS[MessageType((message_state['type'], ))]
        return create_object(message_class, message_state)
Example #2
0
    def _deserialize(self, data_bytes) -> Message:
        message_state = json.loads(data_bytes.decode(encoding=ENCODING))
        self._get_logger().debug('Parsing message: {}...'.format(message_state))

        message_class = TYPE_TO_CLASS[MessageType((message_state['type'],))]
        return create_object(message_class, message_state)
Example #3
0
 def __setstate__(self, state):
     super(MessageWithToken, self).__setstate__(state)
     self._token = create_object(Token, state['token'])
Example #4
0
def deserialize_message(data_bytes, encoding='utf-8') -> Message:
    message_state = json.loads(data_bytes.decode(encoding=encoding))
    message_class = TYPE_TO_CLASS[MessageType((message_state['type'],))]
    return create_object(message_class, message_state)