Files
leaf/examples/meet/server/README.md
Timur Gordon 7ca492346d livekit wip
2025-08-29 15:29:24 +02:00

1.5 KiB

LiveKit Meet Server

A simple backend server to provide connection details for the LiveKit Meet demo app.

Features

  • /api/connection-details endpoint for room connection details
  • CORS support for frontend requests
  • Static file serving for the built WASM app
  • Health check endpoint

Usage

  1. Build the frontend first:
cd .. && trunk build
  1. Run the server:
cd server && cargo run
  1. Access the app at: http://localhost:8083

API Endpoints

  • GET /api/connection-details?roomName=<room>&participantName=<name> - Get connection details
  • GET /health - Health check

Production Setup

For production use, you'll need to:

  1. Replace the mock token generation with proper LiveKit JWT tokens
  2. Add your actual LiveKit server URL
  3. Add proper authentication and validation
  4. Use environment variables for configuration

Example with real LiveKit tokens:

use livekit_api::access_token::{AccessToken, VideoGrant};

fn generate_token(room_name: &str, participant_name: &str) -> String {
    let api_key = std::env::var("LIVEKIT_API_KEY").unwrap();
    let api_secret = std::env::var("LIVEKIT_API_SECRET").unwrap();
    
    let grant = VideoGrant {
        room_join: true,
        room: room_name.to_string(),
        ..Default::default()
    };
    
    let token = AccessToken::new(&api_key, &api_secret)
        .with_identity(participant_name)
        .with_video_grant(grant)
        .to_jwt()
        .unwrap();
        
    token
}