Skip to main content

Module host

Module host 

Source
Expand description

The embedded room host — a browser hosting a place itself.

The presence topology’s P2P tier says participants host each other; the first (and, for a home, only) willing host is a running browser. This module is that capability: one listener that serves BOTH halves of a place —

  • GET (plain HTTP) → the world’s manifest, CORS-open, at any path — so thread://<ip>:<port> resolves via the standard .well-known fetch (ported hosts resolve over plain HTTP: the invite-address convention).
  • WebSocket upgrade → a presence room, driven by the reference relay’s thread_relay::Hub — the exact wire every relay speaks.

The host’s lifetime IS the rule: an owner-tied room (a traveler’s home) lives while the owner’s browser runs it. HomeHost::stop (or drop) tears down the runtime, every guest socket closes, and guests’ browsers walk them home (presence.owner_required in the served manifest tells them to).

Structs§

HomeHost
A running embedded host: manifest server + presence room in one listener.

Functions§

lan_ip
This machine’s LAN address, discovered by routing (no packet is sent).