On Fri, Oct 18, 2024 at 5:56 PM Ruben Perez via Boost
5. According to what I read in the docs, message payloads might contain UTF-8 encoded text or just data blobs, depending on the payload_format_indicator property passed to publish. However, std::string is always used for payloads. As I understand it, if I want to send a binary blob, I need to copy my blob to a string (probably with a reinterpret_cast in the way), and then setting payload_format_indicator. Would it make sense to expose a simpler API taking a blob (e.g. a std::vector<unsigned char>) to make this use case safer?
These days, I'm passing std::span<const std::byte> for binary blobs. This a C++17 lib, so no std::span, but please do consider std::byte at least. --DD PS: I used https://github.com/tcbrindle/span in C++17. Maybe Boost has a span?