Live Map Relays & Gateways
Opening the Live Map on a phone, tablet, or web browser does not require you to know any relay address. The app finds a relay for you.
This guide explains what is required if you or your club want to run a machine as a volunteer relay (such as a clubhouse laptop, venue timing station, or dedicated server). A trailhead tent and a building Wi-Fi network are different setups: Tents and large venues.
Generic Relay Requirements
| What you want to do… | Certificate Required? | Network & Port Requirements |
|---|---|---|
| Assist mobile field devices (Phones, rovers, wearables) | No (updates are already encrypted) | Nothing to configure. Phones on the same tent Wi-Fi share with each other. Works with no internet. |
| Relay on local venue Wi‑Fi (Screens/LAN devices) | No (updates are already encrypted) | A standard port (e.g. 8080) over local Wi‑Fi is sufficient. |
| Serve Web Spectators & PWAs (Web browsers and Progressive Web Apps) | Yes (Valid TLS cert from a trusted CA like Let’s Encrypt) | Must be reachable on a TLS port (typically port 443, or custom TLS ports like 8443). Requires IPv6 firewall permission or IPv4 router port forwarding. |
Why Web Browsers & PWAs Require TLS & Routed Ports
The SwapSanity web app and Progressive Web Apps (PWAs) are delivered over HTTPS (https://app.swapsanity.com).
- Browser Security (Mixed-Content Rules): Modern web browsers strictly block unencrypted
ws://connections originating from HTTPS pages. Web spectators can only connect to securewss://endpoints. - Valid CA Certificate: The certificate must be issued by a recognized Certificate Authority (such as Let’s Encrypt) matching the public DNS hostname.
- Port Routing:
- IPv6: Modern connections with globally routable IPv6 addresses only require permitting incoming TCP traffic on the selected port (typically 443 or 8443) in your firewall rules (no NAT translation needed).
- IPv4: Traditional residential/venue IPv4 connections require configuring Port Forwarding on your router to forward external port 443 (or 8443) to the relay machine’s local IP address.
Public vs campus ports (demos and phones)
Internet browsers and phones off the venue Wi‑Fi should use a relay on TCP 443 (wss://your.host/mesh-stream). A sandbox helper on :8433 (or :80) often works on campus Wi‑Fi and fails on LTE / off-site firewalls. SwapSanity’s public spectator URL is wss://pilot.ceas.wmich.edu/mesh-stream (port 443).
Connecting to that WebSocket does not log you in. Live map dots still show only for members of that group.
Three roles at a venue (pick one per computer)
Do not run the tent radio and the desktop map on the same laptop. They both use the tent radio, and the second start fails.
| Role | What to run | On the mesh? |
|---|---|---|
| Tent radio | swapsanity_cli edge-relay (optional --wss --opt-in --port 8080) |
Yes. This computer is the relay. |
| Operator map | The desktop app (Share + live map) | Yes. This computer is a participant. |
| Kiosk / TV | Browser at http://<tent-laptop>:8080 (on the tent Wi-Fi) or the secure public address |
No. It only watches. |
Internet is optional. Phones on the same Wi‑Fi still share GPS. Without internet, the public website will not update.
LAN kiosk files: copy a Flutter web build, then serve it from the same port as WSS (same origin ws://):
make tent-web-sandbox
swapsanity_cli edge-relay --wss --opt-in --port 8080 --serve-web ~/.swapsanity/tent-web
The tent address opens the map. Google sign-in needs a secure address. A plain http:// clubhouse TV can watch the map.
Linux tent hotspot (--wifi-ap --opt-in): NetworkManager nmcli creates SSID SwapSanity (or --wifi-ssid). Client isolation is off so phones can hear each other. --wifi-ap-dry-run prints the commands without touching the radio. Tear-down is on Ctrl-C. macOS/Windows: make a hotspot yourself. Without internet, phones on that Wi‑Fi still share GPS; the public website will not update.
If the desktop app and edge-relay start together, the second process logs tent radio already running.
Running a Relay via CLI (swapsanity_cli)
1. Join the group mesh (default)
A logged-in relay joins the mesh for your groups. It does not open a browser port until you ask:
swapsanity_cli edge-relay
swapsanity_cli edge-relay --group-id YOUR_GROUP --event-id YOUR_EVENT
2. Host a spectator WSS gateway (explicit)
LAN screens or internet browsers need --wss (and --opt-in on a powered machine):
swapsanity_cli edge-relay --wss --opt-in --port 8080
swapsanity_cli edge-relay --wss --opt-in --port 8080 --serve-web ~/.swapsanity/tent-web
Encrypted logs land under ~/.swapsanity/mesh_blackbox/ for each group, and for an event when you pass --event-id. After the session, build tracks and optionally upload:
swapsanity_cli mesh-reconstruct --group-id YOUR_GROUP
swapsanity_cli mesh-reconstruct --group-id YOUR_GROUP --upload
That writes reconstructed/tracks.json plus per-tag .fit files next to the logs, then (with --upload) stores them for group members. Marking reconstructed and uploaded makes the local logs deletable (mesh-log-mark). If several laptops logged the same group, union them first:
swapsanity_cli mesh-log-merge --group-id YOUR_GROUP --from dir1 --from dir2
3. Public / Dedicated Web Relay (Port 443 + TLS)
For an always-on server or laptop with a domain and Let’s Encrypt certificate:
swapsanity_cli edge-relay \
--wss --public-relay --opt-in \
--port 443 \
--tls-cert /etc/letsencrypt/live/your.host/fullchain.pem \
--tls-key /etc/letsencrypt/live/your.host/privkey.pem \
--announce-url wss://your.host/mesh-stream
--wss: Bind the spectator WebSocket (off unless you pass this flag).--public-relay: Also forward groups you do not belong to (requires--wssand--announce-url).--announce-url: The publicwss://address advertised to spectators (must match the TLS certificate).
Phones use a relay a member is running when one is available. Browsers use that same computer when it is reachable and keeping up. If it falls behind or the connection drops, browsers move to the next public relay. SwapSanity’s own relays stay in that list at the lowest priority, and only while a browser has the map open. With no browser watching, those relays stay quiet. Phones stay on a relay that is still taking their updates.
Each relay can limit how much of its own connection a full field uses. Phones still send location at the pace in their location settings. Leave the ceiling unset on a small link. Raise it on a larger link. When two relays share one connection, leave the spare on the default and raise the ceiling on the main relay.
--snapshot-budget: a byte count, or ak/msuffix such as256kor2m. Unset keeps the built-in default.--snapshot-max-gap: the longest wait, in seconds. Unset keeps the built-in default.
End-to-End Security & Privacy
Live GPS is encrypted on the phone before it leaves.
A relay, including a public relay you do not own, only forwards those updates: - It cannot read member coordinates. - It cannot invent a location. - A damaged update is dropped by the phones that receive it.