# johni0702/mumble-web architecture

> Architecture diagram of the GitHub repository johni0702/mumble-web, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/johni0702/mumble-web
- Repository: https://github.com/johni0702/mumble-web

## Overview

##### Main Components

a) Client-Side Components (Browser):
- HTML5 Frontend (from app/index.html)
- WebSocket Client
- WebRTC Audio Handler
- Worker Thread (from worker.js)
- Theme Engine (from theme.js)
- Localization System (from loc.js)

b) Server-Side Components:
- WebSocket Server
- WebRTC Handler
- Mumble Protocol Adapter

c) External Systems:
- Mumble Server
- Web Server (NGINX/Caddy)
- Matrix Integration (optional component)

##### Connection Flow

- Secure WebSocket connections (WSS) from browser to web server
- WebSocket connection from web server to mumble-web-proxy
- TCP/UDP connection from mumble-web-proxy to Mumble server
- WebRTC media streams (when available)
- Fallback audio path using WebSocket when WebRTC is unavailable

##### Specific Implementation Details

- Supported codecs (Opus for WebRTC, Opus/CELT Alpha for fallback)
- Configuration flow (config.js -> config.local.js)
- Theme system (MetroMumbleLight/Dark)
- Localization files (en.json, de.json, etc.)

##### Technical Details

Annotations for:
- Port numbers (64737 for WebSocket, 64738 for Mumble)
- Supported protocols (WebRTC, WebSocket)
- Security layers (SSL/TLS termination at web server)
- Codec support limitations

##### Component Relationships

Clear relationships between:
- Frontend and worker thread communication
- Theme engine and UI components
- Localization system and UI elements
- WebRTC/WebSocket fallback mechanism

For the Matrix integration, create a separate "Matrix Mode" view showing how the widget interfaces with the main application components.

Remember to include a version indicator and any relevant build/deployment information from the webpack configuration, as this will be important for understanding how the system is assembled and deployed.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Browser["Browser Environment"]
        direction TB
        Frontend["HTML5 Frontend"]
        AudioHandler["WebRTC Audio Handler"]
        WSClient["WebSocket Client"]
        Worker["Worker Thread"]
        Theme["Theme Engine"]
        Loc["Localization System"]
        Matrix["Matrix Integration"]
        Config["Configuration System"]
    end

    subgraph Proxy["mumble-web-proxy"]
        direction TB
        WSServer["WebSocket Server"]
        WebRTC["WebRTC Handler"]
        MumbleAdapter["Mumble Protocol Adapter"]
    end

    subgraph External["External Systems"]
        direction TB
        WebServer["Web Server (NGINX/Caddy)"]
        MumbleServer["Mumble Server"]
        MatrixServer["Matrix Server"]
    end

    subgraph ThemeSystem["Theme System"]
        direction TB
        LightTheme["Metro Mumble Light"]
        DarkTheme["Metro Mumble Dark"]
    end

    subgraph LocaleSystem["Localization Files"]
        direction TB
        EN["English (en.json)"]
        DE["German (de.json)"]
    end

    %% Connections
    Frontend --> WSClient
    Frontend --> AudioHandler
    Frontend --> Worker
    Frontend --> Theme
    Frontend --> Loc
    Frontend --> Matrix
    Frontend --> Config

    WSClient --> WebServer
    WebServer --> WSServer
    WSServer --> MumbleAdapter
    MumbleAdapter --> MumbleServer

    AudioHandler --> WebRTC
    WebRTC --> MumbleServer

    Theme --> ThemeSystem
    Loc --> LocaleSystem
    Matrix --> MatrixServer

    %% Click Events
    click Frontend "https://github.com/Johni0702/mumble-web/blob/master/app/index.html"
    click AudioHandler "https://github.com/Johni0702/mumble-web/blob/master/app/voice.js"
    click Worker "https://github.com/Johni0702/mumble-web/blob/master/app/worker.js"
    click Theme "https://github.com/Johni0702/mumble-web/blob/master/app/theme.js"
    click Loc "https://github.com/Johni0702/mumble-web/blob/master/app/loc.js"
    click Matrix "https://github.com/Johni0702/mumble-web/blob/master/app/matrix.js"
    click Config "https://github.com/Johni0702/mumble-web/blob/master/app/config.js"
    click LightTheme "https://github.com/Johni0702/mumble-web/tree/master/themes/MetroMumbleLight/"
    click DarkTheme "https://github.com/Johni0702/mumble-web/tree/master/themes/MetroMumbleDark/"
    click LocaleSystem "https://github.com/Johni0702/mumble-web/tree/master/loc/"

    %% Styling
    classDef browser fill:#dae8fc,stroke:#6c8ebf
    classDef proxy fill:#d5e8d4,stroke:#82b366
    classDef external fill:#f5f5f5,stroke:#666666
    classDef theme fill:#fff2cc,stroke:#d6b656
    classDef locale fill:#e1d5e7,stroke:#9673a6
    classDef critical stroke:#ff0000,stroke-width:2px
    classDef fallback stroke:#ffa500,stroke-width:2px

    class Frontend,AudioHandler,WSClient,Worker,Theme,Loc,Matrix,Config browser
    class WSServer,WebRTC,MumbleAdapter proxy
    class WebServer,MumbleServer,MatrixServer external
    class LightTheme,DarkTheme theme
    class EN,DE locale
    class AudioHandler,WSClient critical
    class WSServer fallback
```
