#[unsafe(no_mangle)]pub unsafe extern "C" fn pamoja_mqtt_client_publish_with(
client: *mut PamojaMqttClient,
topic: *const c_char,
payload: *const u8,
payload_len: usize,
qos: PamojaQos,
retain: bool,
confirmed: bool,
) -> PamojaStatusExpand description
Publishes a payload to a topic with options of its own, optionally waiting for the broker to acknowledge it.
§Arguments
client- the client.topic- the destination topic, with no wildcard.payload- the message.payload_len- how many bytespayloadholds.qos- the quality of service for this message.retain- whether the broker keeps it for clients that subscribe later; an empty retained message clears the one the broker holds.confirmed- whether to return only once the broker acknowledges the message: itsPUBACKat QoS 1, itsPUBCOMPat QoS 2, and once the connection has taken it at QoS 0, where MQTT acknowledges nothing.
§Returns
PamojaStatus::Ok once the message is queued, or acknowledged when confirmed is
set, or an error status. A confirmed publish whose connection ends first fails with
PamojaStatus::Transport, when the message may or may not have arrived.
§Safety
client must be a live handle from pamoja_mqtt_client_new; topic must be a valid
null-terminated UTF-8 string; and payload must point to at least payload_len bytes,
or be null when payload_len is 0.