feat: add a basic_room demo (#62)

This commit is contained in:
Théo Monnom
2023-05-09 15:08:57 +02:00
committed by GitHub
parent 1beee0e1f7
commit e8d1c7ee73
12 changed files with 53 additions and 19 deletions
+8
View File
@@ -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" }
+18
View File
@@ -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);
}
}