put method

void put(
  1. String value, {
  2. Encoding? encoding,
  3. ZBytes? attachment,
})

Publishes a string value through this advanced publisher.

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

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

Implementation

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