auto s = fxMessageResponse.SerializeAsString(); //this returns std::string std::vector bytes(s.size()); std::copy( s.begin(), s.end()