Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Shyamalp16/CloudGaming/llms.txt
Use this file to discover all available pages before exploring further.
Overview
The CloudGaming client is a single-page HTML5 application that:- Requests a host assignment from the matchmaker
- Establishes WebRTC connection via the signaling server
- Receives video/audio streams from the Windows host
- Sends keyboard, mouse, and gamepad input back to the host
- Provides on-screen controls and connection status
File Structure
The client consists of a single HTML file with embedded CSS and JavaScript:Configuration
Updating Service URLs
The client reads configuration from a<script> block in index.html. Update these values before deployment:
CORS Configuration
Ensure your backend services allow requests from your client domain: Signaling Server (Server/.env):
Server/mm_server/Matchmaker.js):
Local Development
For local testing:Production Deployment
The client is a static site and can be deployed to any hosting platform.Vercel
Deploy
- Upload the static files
- Configure HTTPS automatically
- Provide a production URL (e.g.,
https://cloudgaming.vercel.app)
vercel.json configures headers and routing:
Cloudflare Pages
Create Cloudflare Pages project
- Go to Cloudflare Dashboard → Pages
- Connect to Git → Select repository
- Configure build:
- Framework preset: None
- Build command: (leave empty)
- Build output directory:
Client/html-server
Netlify
Deploy
- Visit app.netlify.com/drop
- Drag the
Client/html-server/folder - Netlify provides instant HTTPS deployment
AWS S3 + CloudFront
GitHub Pages
Docker / Self-Hosted
For self-hosting with nginx:- Docker
- nginx config
Create Build and run:
Dockerfile in Client/html-server/:WebRTC Configuration
ICE Servers
The client receives ICE servers (STUN/TURN) from the matchmaker. For testing, you can hardcode fallback servers:Firewall and NAT
For WebRTC to work:- STUN: UDP ports 3478, 19302 (usually not blocked)
- TURN: TCP/UDP ports 3478, 443 (may require configuration)
- RTC: UDP ports 49152-65535 (ephemeral range, often blocked by corporate firewalls)
Client Features
Controls
The client includes on-screen controls:- Fullscreen toggle: Expands video to fullscreen
- Settings: Adjust quality, latency, input settings
- Disconnect: Close the streaming session
- Stats overlay: Display connection statistics (FPS, latency, bitrate)
Keyboard and Mouse Capture
Input capture activates when the user clicks on the video stream:Gamepad Support
The client automatically detects and forwards gamepad input:Mobile/Touch Support
The client includes basic touch controls:- Touch drag: Mouse movement
- Single tap: Left click
- Long press: Right click
- Pinch zoom: Disabled (to prevent accidental zoom)
For production mobile deployment, consider implementing an on-screen virtual gamepad or custom touch controls.
Troubleshooting
Error: No hosts available
Error: No hosts available
Symptoms: Matchmaker returns 404 or
{"found": false}Solutions:- Verify at least one Windows host is running and sending heartbeats
- Check matchmaker
/api/hostsendpoint:curl https://matchmaker.yourdomain.com/api/hosts - Ensure host and matchmaker are using the same
HOST_SECRET - Check region matching (client requests
us-eastbut hosts areeu-west)
Error: WebSocket connection failed
Error: WebSocket connection failed
Symptoms: Cannot connect to signaling serverSolutions:
- Verify signaling server is running:
curl https://signaling.yourdomain.com/healthz - Check browser console for WebSocket errors
- Ensure
signalingUrluseswss://(secure WebSocket) for HTTPS sites - Check CORS and
ALLOWED_ORIGINSin signaling server config - Verify firewall/load balancer allows WebSocket upgrades
Video not displaying
Video not displaying
Symptoms: Connection established but black screenSolutions:
- Check browser console for WebRTC errors
- Verify host is capturing and encoding video (check host logs)
- Test with
chrome://webrtc-internals(Chrome) orabout:webrtc(Firefox) - Ensure video codec is supported (H.264 is universally supported)
- Check if
<video>element hasautoplayandplaysinlineattributes
High latency or stuttering
High latency or stuttering
Symptoms: Visible input delay or choppy videoSolutions:
- Check network latency: Use browser DevTools Network tab
- Verify host encoding settings (lower
preset,cbrrate control) - Enable hardware acceleration in browser settings
- Reduce video bitrate or resolution on host
- Check CPU/GPU usage on both client and host
- Test with
chrome://webrtc-internalsto see packet loss and jitter
Input not working
Input not working
Symptoms: Keyboard/mouse input not reaching the hostSolutions:
- Click on the video to activate pointer lock
- Check browser console for input capture errors
- Verify host input injection is enabled (
injectionPolicy: "REQUIRE_FOREGROUND") - Ensure target game window is in foreground on host
- Test with simple applications (Notepad) before games
- Check if DataChannels are established in
chrome://webrtc-internals
CORS errors in console
CORS errors in console
Symptoms:
Access-Control-Allow-Origin errorsSolutions:- Add client domain to signaling server
ALLOWED_ORIGINS - Enable CORS in matchmaker (currently allows all origins by default)
- Use a reverse proxy (nginx, Cloudflare) to add CORS headers
- For development, use
http://localhost(not127.0.0.1orfile://)
WebRTC connection fails (ICE failed)
WebRTC connection fails (ICE failed)
Symptoms: Solutions:
iceConnectionState remains checking or goes to failedDiagnosis:- Check if TURN servers are configured in matchmaker
- Test TURN connectivity: Trickle ICE
- Verify firewall allows UDP on ephemeral ports (49152-65535)
- For corporate networks, use TURN over TCP port 443
- Check browser console for ICE candidate gathering errors
Performance Optimization
Client-Side
- Hardware acceleration: Ensure it’s enabled in browser settings
- Browser choice: Chrome/Edge have best WebRTC performance
- Close other tabs: Reduce CPU/memory pressure
- Wired connection: WiFi adds latency and packet loss
- Disable browser extensions: Ad blockers can interfere with WebRTC
CDN and Caching
For global deployments:Security Best Practices
Content Security Policy
Add CSP headers to prevent XSS attacks:Next Steps
- Host Setup - Ensure Windows hosts are properly configured
- Signaling Server - Verify signaling infrastructure
- Matchmaker - Configure host discovery and TURN servers
- Deployment Overview - Review complete architecture