rsiot/components/cmp_mqtt_client/tasks/
shared.rs

1
2
3
4
5
6
7
8
9
10
11
12
use rumqttc::{AsyncClient, QoS};

pub async fn publish_on_broker(
    topic: String,
    payload: Vec<u8>,
    client: &AsyncClient,
) -> super::Result<()> {
    client
        .publish(topic, QoS::ExactlyOnce, true, payload)
        .await?;
    Ok(())
}