This tool is a nearby Closed Captioner radio: it sends and receives over Multipeer Connectivity (local Wi‑Fi and/or Bluetooth). It does not use cellular or any server.
“Radio” matches the in-app control — one peer that can talk both ways.
swift --version)From the repository root:
cd tools/p2p-radio
swift run p2p-radio
It starts silent. Nothing is sent until you type a line and press Enter.
On the phone:
[Your-Mac-Name] your text.Incoming traffic on the Mac prints as:
[Karthiks-iPhone] hello 14:02:11
If the line was relayed (someone else originated it; a neighbor forwarded it here), the neighbor that emitted it to this process is appended:
[Karthiks-iPhone] hello 14:02:11 via Mids-iPhone
Two Mac processes can talk to each other the same way.
Ctrl+C stops.
cc-p2p (see P2PConfig.swift).p2p-radio process: quit the old terminal (Ctrl+C) and swift run again, then toggle radio off/on on the phone.Inviting … → connecting → notConnected: rebuild the app (encryption is optional for iOS↔Mac) and restart the Mac tool. Allow Local Network for Terminal if macOS asks.This stub travels over local Wi‑Fi / Bonjour more often than Bluetooth. Two iPhones are still required to prove Bluetooth in a room with no network.
JSON envelope, UTF-8:
{"v":1,"text":"hello","from":"Karthiks-MacBook"}
Bonjour service type: cc-p2p (_cc-p2p._tcp in the iOS Info.plist).
Discovery info: role=emit, id=<uuid>.
Keep Sources/RadioPeer/P2PConfig.swift in sync with ClosedCaptioner/Services/P2PConfig.swift.