publish_tcp/
publish_tcp.rs1#[tokio::main]
2async fn main() -> Result<(), String> {
3 let client_type = simple_pub_sub::client::PubSubTcpClient {
4 server: "localhost".to_string(),
5 port: 6480,
6 cert: None,
7 cert_password: None,
8 };
9
10 let mut client =
12 simple_pub_sub::client::Client::new(simple_pub_sub::client::PubSubClient::Tcp(client_type));
13 let _ = client.connect().await;
15 let _ = client
17 .publish(
18 "abc".to_string(),
19 "test message".to_string().into_bytes().to_vec(),
20 )
21 .await;
22 Ok(())
23}