server/README.md

2.2 KiB

Meet Server

The high-performance signaling and media relay server for the Meet application. Built with Rust, Axum, and Tokio.

Features

  • Signaling: WebSocket-based room management and peer discovery.
  • Media Relay: Custom UDP protocol for low-latency video and screen sharing.
  • Architecture: Asynchronous, localized state management using DashMap.

Prerequisites

  • Rust: Latest stable version. Install via rustup.rs.
  • Build Tools: build-essential (Ubuntu) or Development Tools group (Fedora/RHEL).

Installation

  1. Clone the Repository:

    git clone <your-server-repo-url>
    cd server
    
  2. Verify Shared Crate: Ensure the shared directory exists in the root. This contains protocol definitions used by both client (logic port) and server.

    ls -F shared/
    
  3. Build:

    cargo build --release
    

    The binary will be located at target/release/server.

Running the Server

Ports

  • TCP/WebSocket: 6000 (Bind: 0.0.0.0:6000)
  • UDP (Media): 4000 (Bind: 0.0.0.0:4000)

Local Development

cargo run

Runs on 0.0.0.0:6000 (HTTP/WS) and 0.0.0.0:4000 (UDP).

Production Deployment

  1. Run the Binary:
    ./target/release/server
    
  2. Firewall: Ensure TCP 6000 and UDP 4000 are open.
    # Fedora/CentOS
    sudo firewall-cmd --add-port=6000/tcp --permanent
    sudo firewall-cmd --add-port=4000/udp --permanent
    sudo firewall-cmd --reload
    
    # Ubuntu/Debian (UFW)
    sudo ufw allow 6000/tcp
    sudo ufw allow 4000/udp
    
  3. Systemd (Optional): Create a service file /etc/systemd/system/meet-server.service to keep it running.

Project Structure

  • src/main.rs: Entry point. Sets up Axum router and spawns the UDP listener.
  • src/handlers.rs: WebSocket handlers for joining rooms, signaling, and chat.
  • src/udp.rs: The core UDP packet handling loop. Manages media relaying.
  • src/state.rs: Shared application state (Rooms, Peers).
  • shared/: Local crate containing shared data structures (Packet headers, MediaType enums).