putBytes method

void putBytes(
  1. ZBytes payload, {
  2. Encoding? encoding,
  3. ZBytes? attachment,
})

Publishes ZBytes payload through this advanced publisher.

The payload is consumed by this call and must not be reused. Optionally set the encoding (MIME type) of the message. An optional attachment can be included; it is also consumed by this call.

Throws ZenohException if the encoding is malformed or the put fails.

Implementation

void putBytes(ZBytes payload, {Encoding? encoding, ZBytes? attachment}) {
  _ensureOpen();
  final loaned = bindings.zd_advanced_publisher_loan(_ptr.cast());
  _put(loaned.cast(), payload, encoding, attachment);
}