An independent LNbits WASM extension for host-led livestreams, anonymous viewers, three guest speakers, Lightning admission, tips and paid questions. Media travels over real Iroh connections to a separately operated application broadcaster.
- LNbits 1.7.1 with the generic browser bridge described below. A version
number alone does not establish compatibility. Development used core commit
f862e553c23faeff952cead99455ecf7ff4bf2d3. - Core frontend assets must be rebuilt after adding its browser bridge. Both
the minified components and
static/vendor.jsonmust includejs/wasm-browser.jsbeforejs/wasm-extension-component.js. A stale bundle reportsUnknown extension bridge action; a stale unbundled asset list reportsLNbitsBrowserSession is not a constructor. The core administrator must rebuild core assets; the extension must not inject trusted scripts. - One LNbits application worker and one broadcaster per room. Synchronous WASM exports serialize purchases for an owner within that worker. Multiple core workers are unsupported until core supplies a cross-worker transaction/lock.
- HTTPS for viewers and the broadcaster's LNbits API, except localhost testing.
- Chromium with MediaRecorder VP8/Opus and MediaSource WebM playback. Other browsers are feature-detected; see verification.
- Node 22.18+ for the broadcaster. Rust 1.91+ and Clang for source builds.
Place this repository at data/wasm_extensions/liverooms (or your configured
LNBITS_WASM_EXTENSIONS_PATH/liverooms). It must not be inside Python's
importable lnbits/extensions directory. Built WASM and browser assets are
included. Restart LNbits: its existing extension discovery installs the storage
migration. Enable Live Rooms for your account in Extensions and review its
requested permissions. No wallet spending permission is requested.
Build the native broadcaster for its host operating system:
cargo build --manifest-path transport/Cargo.toml --release --bin liverooms-transport --locked
LIVEROOMS_LNBITS_URL=https://your-lnbits.example node broadcaster/main.mjsKeep this process running independently of LNbits. It prints a public endpoint
and relay. The private endpoint key is created with mode 0600 in
.runtime/endpoint.key. Keep it across restarts; replacing it changes the
endpoint identity and existing rooms will reject the replacement. Do not expose
this key, room session credentials, or .runtime over HTTP.
Open /ext/liverooms, choose a receiving wallet, paste the broadcaster endpoint
and relay, set the prices and audience limit, and create a room. Preview your
devices, click Go live, and approve the LNbits network permission dialog.
Share the guest link shown in the studio. Guests do not need LNbits accounts.
Guest admission belongs to a randomly generated browser session credential. Reconnecting or reloading in the same browser retains that admission. Clearing site data, private-window closure, or losing the credential loses the session; there is no account recovery or transferable admission link in this MVP.
The host approves speaker requests. Approval never activates another person's devices. Speakers click the camera/microphone controls and consent themselves. Host muting removes audio at the broadcaster; revocation stops publishing; kicking closes the connection and permanently invalidates that room credential.
Admission, tips and highlighted questions use core create-invoice-public and
invoice-status. Each invoice has an immutable room/session/purchase binding.
Only trusted core settlement of the exact expected amount and source fulfils a
purchase. Payment events and polling are idempotent. A late payment cannot
restore a kicked session. Unknown invoice-creation outcomes are retained as
creating for inspection rather than retried with another invoice.
Speaker tips use receiving Lightning wallets that the organizer can manage, including core-supported shared wallets. Add these destinations in the studio. Live Rooms never receives wallet API keys and never automatically spends funds. Paid questions require explicit acknowledgement that payment does not guarantee an answer. Settled questions can be delivered to chat and recovered after a broadcaster restart; ordinary chat and reactions are transient.
| Variable | Default | Purpose |
|---|---|---|
LIVEROOMS_LNBITS_URL |
http://127.0.0.1:5000 |
Trusted core API origin; remote origins require HTTPS |
LIVEROOMS_AUDIENCE_LIMIT |
2 |
Maximum non-host connections per room, 1–64; room setting may lower it |
LIVEROOMS_RELAYS |
Four defaults below | JSON array of HTTPS Iroh relay origins |
LIVEROOMS_KEY_FILE |
.runtime/endpoint.key |
Persistent private broadcaster identity |
LIVEROOMS_TRANSPORT |
transport/target/release/liverooms-transport |
Native executable path |
Run under your operating system's process supervisor with a dedicated account, an absolute working directory and a persistent private key directory. Stop with SIGTERM. The broadcaster needs outgoing HTTPS/WSS to its configured relays and access to the LNbits API. It does not expose a public HTTP listener. It has no LNbits administrator key. Media is decrypted at this trusted broadcaster for fanout and enforcement; public relays only carry encrypted Iroh traffic.
Start with the measured limit in verification. The default of two follows the successful local media measurement. To use all three guest-speaker slots, provision and measure capacity for at least three guests, then raise both the broadcaster ceiling and room setting. Larger audience limits are not a production capacity claim. Browser recording uses core's bitrate and timing limits. Each extra viewer adds broadcaster outbound bandwidth for every active stream. Slow consumers are disconnected instead of growing unbounded queues.
The defaults come from Iroh v1.3.0 defaults:
https://use1-1.relay.n0.iroh.link/https://usw1-1.relay.n0.iroh.link/https://euc1-1.relay.n0.iroh.link/https://aps1-1.relay.n0.iroh.link/
All four completed an iroh-relay-v2 WebSocket handshake during development.
Their availability is not guaranteed. Users can remove/add relays or restore
defaults in the UI. The broadcaster's relay is always included so its advertised
endpoint remains reachable. Failed connections appear in relay settings.
The public relay service
is intended for development and hobby use. Its
connection rate limits can
pause forwarding when a connection exceeds its allowance; current numerical
limits are not published. Sustained livestreams may require a higher-capacity
or self-hosted Iroh relay. Adding more public relay URLs does not increase a
single connection's bandwidth allowance. Set LIVEROOMS_DEBUG=1 to log native
relay traffic counters and rate-limit notices while diagnosing a deployment.
For a new custom relay, first declare its exact HTTPS and WSS origins in
config.json under ui.network.https and ui.network.websocket. The
administrator must then approve those origins in the installed extension's
permission settings. Core rejects grants broader than the manifest, including
administrator grants. See relay setup.
Restart LNbits after editing the manifest; its browser-policy route retains the
declarations loaded at startup.
Then the browser asks for session approval through core's trusted dialog.
Wildcards, private network destinations and arbitrary proxying are not used.
Live Rooms imports only the checked-in WIT contract.
It requires owner-scoped storage, random IDs, time, receiving-wallet listing,
public invoices bound to a storage source, invoice status, and invoice-paid
events. Public routes use core ownerContext resolution and then validate the
application session credential themselves.
The browser uses the existing connectBrowser SDK and its request('api'),
request('context'), scoped storage.local.*, capabilities, approve,
websocket, https, capture, and playback interfaces. Capture handles expose
record; playback handles expose append; both expose close and lifecycle
events. Raw camera tracks never enter the extension frame. Core owns dialogs,
browser consent, preview/playback elements and resource revocation.
The extension's Iroh adapter implements the browser WebSocket/fetch surface needed by the separately compiled Iroh WASM module. External traffic goes through the permission bridge. Only extension assets are fetched directly. No Iroh code or dependency is installed into core. Media never passes through LNbits HTTP handlers, database calls or application WebSockets.
npm ci
rustup target add wasm32-unknown-unknown
cargo install wasm-bindgen-cli --version 0.2.122 --locked
make build-transport
make build
make check
LNBITS_CORE_PATH=/path/to/lnbits make test-host PYTHON=/path/to/lnbits/.venv/bin/python
make packagemake build-transport requires a Clang with the WASM target. On macOS set
CC_wasm32_unknown_unknown and AR_wasm32_unknown_unknown to an LLVM Clang and
llvm-ar if Apple Clang lacks it. Cargo.lock and package-lock.json pin builds.
No runtime JavaScript packages are needed by the Node broadcaster.
make check runs source/manifest checks and focused unit tests. test-host
executes the compiled component against real core host imports and a disposable
database, substituting only the funding boundary. No new end-to-end test suite
is added. Browser smoke results and limitations are recorded separately.
Recordings, memberships, metered billing, YouTube broadcasting and advanced analytics are intentionally outside this MVP.