feat: add a basic_room demo (#62)
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
[package]
|
||||
name = "basic_room"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
tokio = { version = "1", features = ["full"] }
|
||||
livekit = { path = "../../livekit", version = "0.1.1" }
|
||||
@@ -0,0 +1,18 @@
|
||||
use livekit::prelude::*;
|
||||
use std::env;
|
||||
|
||||
// Basic demo to connect to a room using the specified env variables
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
let url = env::var("LIVEKIT_URL").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).await.unwrap();
|
||||
let session = room.session();
|
||||
println!("Connected to room: {} - {}", session.name(), session.sid());
|
||||
|
||||
while let Some(msg) = rx.recv().await {
|
||||
println!("Event: {:?}", msg);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user