client_sender/
client_sender.rs1use busrt::client::AsyncClient;
3use busrt::ipc::{Client, Config};
4use busrt::QoS;
5
6#[tokio::main]
7async fn main() -> Result<(), Box<dyn std::error::Error>> {
8 let name = "test.client.sender";
9 let config = Config::new("/tmp/busrt.sock", name);
11 let mut client = Client::connect(&config).await?;
12 let opc = client
14 .publish("some/topic", "hello".as_bytes().into(), QoS::Processed)
15 .await?
16 .expect("no op");
17 opc.await??;
18 let opc = client
20 .send(
21 "test.client.listener",
22 "hello".as_bytes().into(),
23 QoS::Processed,
24 )
25 .await?
26 .expect("no op");
27 opc.await??;
28 let opc = client
30 .send_broadcast("test.*", "hello everyone".as_bytes().into(), QoS::Processed)
31 .await?
32 .expect("no op");
33 opc.await??;
34 Ok(())
35}