P2P Signaling Server (Cloudflare Workers) ========================================= Endpoints: GET /create Returns: { "code": "UUID" } (Optional: Useful for unique room generation) WS /match/{ANY_KEY} Role-based P2P signaling using a shared key or UUID. Usage Flow: 1. Both: Choose a shared {ANY_KEY} (e.g., "secret-room-123") 2. Host: Connect to WS /match/{ANY_KEY} Receive: { "type": "assigned_role", "role": "host" } 3. Guest: Connect to WS /match/{ANY_KEY} Receive: { "type": "assigned_role", "role": "guest" } 4. Both: Receive { "type": "matched" } once both are connected. 5. Both: Obtain Global IP/Port via STUN, then send: Send: { "type": "offer", "address": "1.2.3.4:12345" } 6. Both: Receive { "type": "peer", "address": "1.2.3.4:12345" } Final Step: Initiate UDP hole punching toward the peer.