basic connection listening

This commit is contained in:
talksik
2023-06-30 15:08:26 -07:00
parent ca1878dd6e
commit 05f936c15b
3 changed files with 2120 additions and 2 deletions
Generated
+2097
View File
File diff suppressed because it is too large Load Diff
+4
View File
@@ -6,3 +6,7 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
tokio = { version = "1", features = ["full"] }
env_logger = "0.10"
livekit = { version = "0.1.2" }
log = "0.4"
+19 -2
View File
@@ -1,3 +1,20 @@
fn main() {
println!("Hello, world!");
use livekit::prelude::*;
use std::env;
// Connect to a room using the specified env variables
// and print all incoming events
#[tokio::main]
async fn main() {
env_logger::init();
let url = env::var("0.0.0.0:7880").expect("LIVEKIT_URL is not set");
let token = env::var("LIVEKIT_TOKEN").expect("LIVEKIT_TOKEN is not set");
let (room, mut rx) = Room::connect(&url, &token, RoomOptions::default()).await.unwrap();
log::info!("Connected to room: {} - {}", room.name(), room.sid());
while let Some(msg) = rx.recv().await {
log::info!("Event: {:?}", msg);
}
}