Skip to main content

Module relay

Module relay 

Source
Expand description

Relay conformance — does a presence relay speak presence-wire-v0.1?

The substance is the pure validators — check_welcome and check_pose turn a wire message into conformance clauses with no network, so the spec’s rules are pinned by unit tests today. probe is the thin live driver: it connects to a relay, joins, and runs those validators on the real messages it sees — ready the moment a relay is deployed.

Structs§

RelayOutcome
The result of a live relay probe.

Functions§

check_observer_welcome
Validate the welcome a relay sends in reply to observe (§2). An observer watches without entering, so its welcome differs from a joiner’s in exactly two ways — it says so, and it is given the non-occupant id 0 — while still carrying the roster as it stands, so a watcher arriving mid-session sees who is already there rather than only who arrives next.
check_pose
Validate a pose message (the hot path, §3–§4). ts (server stamp) and v (velocity) are mandatory — they’re exactly what a client needs to interpolate without trusting peer clocks — so their absence is an Error.
check_welcome
Validate a welcome message (relay→client, in reply to join). Per §2 a conformant welcome assigns an occupant id, lists occupants, and declares a tick_hz.
probe
Connect to url (wss://<relay>/thread/<worldId>), join with passport, and run the wire validators on what the relay sends back. Best-effort: with a single probe client the relay may not fan a pose back (area-of-interest / no peers), so a missing pose is a note, not a failure — the pinned validators carry the spec.