basic connection listening
This commit is contained in:
Generated
+2097
File diff suppressed because it is too large
Load Diff
@@ -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
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user