static function decodeMessage(string $data) {
        try {
            $message = \unserialize(\base64_decode(\rtrim($data, static::END_BUFFER)));
            if(!($message instanceof \CharlotteDunois\Phoebe\Message)) {
                throw new \Exception('');
            }
            
            return $message;
        } catch (\Throwable $e) {
            throw new \InvalidArgumentException('Invalid phoebe message');
        }
    }