feat(webrtc): integrate Cloudflare TURN/STUN servers
- Add backend endpoint to fetch ICE server credentials from Cloudflare - Implement dynamic ICE server configuration in frontend - Add fallback to public STUN servers when Cloudflare unavailable - Create comprehensive test suite for WebRTC API endpoint - Update environment configuration with Cloudflare TURN credentials Backend changes: - New route: GET /api/webrtc/ice-servers (authenticated) - Fetches temporary credentials from Cloudflare API with 24h TTL - Returns formatted ICE servers for RTCPeerConnection - Graceful fallback to Google STUN servers on errors Frontend changes: - Remove hardcoded ICE servers from useWebRTC hook - Fetch ICE servers dynamically from backend on mount - Store servers in ref for peer connection initialization - Add webrtcAPI service for backend communication Tests: - 9 comprehensive tests covering all scenarios - 100% coverage for webrtc.js route - Tests authentication, success, and all fallback scenarios
This commit is contained in:
@@ -62,3 +62,8 @@ MATCHING_MIN_INTERVAL_SEC=60
|
||||
# Cloudflare Turnstile (CAPTCHA)
|
||||
# Get your secret key from: https://dash.cloudflare.com/
|
||||
TURNSTILE_SECRET_KEY=your-secret-key-here
|
||||
|
||||
# Cloudflare TURN/STUN
|
||||
# Get your credentials from: https://dash.cloudflare.com/ -> Calls -> TURN
|
||||
CLOUDFLARE_TURN_TOKEN_ID=your-turn-token-id-here
|
||||
CLOUDFLARE_TURN_API_TOKEN=your-turn-api-token-here
|
||||
|
||||
Reference in New Issue
Block a user