From da344fa83db5f3a28dfe5a70df62ace1f7bfd479 Mon Sep 17 00:00:00 2001 From: neonphog Date: Tue, 7 May 2024 14:54:20 -0600 Subject: [PATCH] fix connect example --- crates/tx5-signal/examples/connect.rs | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/crates/tx5-signal/examples/connect.rs b/crates/tx5-signal/examples/connect.rs index a2365f1d..dea05586 100644 --- a/crates/tx5-signal/examples/connect.rs +++ b/crates/tx5-signal/examples/connect.rs @@ -20,16 +20,17 @@ async fn main() { tracing::info!(%sig_url); - /* - let (cli, _rcv) = tx5_signal::Cli::builder() - .with_url(sig_url) - .build() - .await - .expect("expect can build tx5_signal::Cli"); + let config = tx5_signal::SignalConfig { + allow_plain_text: true, + ..Default::default() + }; - println!( - "{}", - serde_json::to_string_pretty(&cli.ice_servers()).expect("expect json") - ); - */ + let (con, _recv) = tx5_signal::SignalConnection::connect( + &sig_url, + std::sync::Arc::new(config), + ) + .await + .unwrap(); + + println!("Connected at: {sig_url}/{:?}", con.pub_key()); }