Overview
Network configuration controls signaling server connections, matchmaker registration, ICE/TURN server setup for NAT traversal, and keepalive settings.Client Configuration
Browser client connection endpoints.WebSocket URL for the signaling server.Default:
wss://signaling-server-production-acd4.up.railway.appMust use wss:// for secure WebSocket in production.Examples:- Development:
ws://localhost:3002 - Production:
wss://signaling.example.com
HTTP(S) URL for the matchmaker service.Default:
https://matchmaker-production-5b36.up.railway.appMatchmaker assigns clients to available hosts.Examples:- Development:
http://localhost:3000 - Production:
https://matchmaker.example.com
Host Signaling
WebSocket URL for host-to-signaling-server connection.Default:
wss://signaling-server-production-acd4.up.railway.appShould match client.serverUrlBase to ensure hosts and clients connect to the same signaling server.Matchmaker Configuration
The matchmaker service manages host registration and client-to-host assignment.HTTP(S) URL for matchmaker endpoint.Default:
https://matchmaker-production-5b36.up.railway.appHost registers itself with this service and maintains keepalive.Shared secret for host authentication.Default:
HELLO-MFSUsed to authenticate host registration requests.Generate a secure secret:Host keepalive interval in milliseconds.Default:
20000 (20 seconds)Host sends periodic heartbeats to matchmaker to indicate availability.Recommended:10000-20000- Standard (default)5000-10000- Fast failover (higher network traffic)30000-60000- Low traffic (slower failover)
ICE and TURN Configuration
ICE (Interactive Connectivity Establishment) and TURN (Traversal Using Relays around NAT) enable WebRTC connections through firewalls and NAT.Default Behavior
The CloudGaming host uses default ICE servers configured in the Pion WebRTC library. For most local networks and direct connections, this is sufficient.Custom ICE/TURN Servers
For production deployments or restrictive networks, configure custom TURN servers in your WebRTC connection code. Client-side ICE configuration (JavaScript):gortc_main/ to add custom ICE servers to the Pion WebRTC configuration.
Public STUN Servers
Free STUN servers for NAT traversal (no relay):stun:stun.l.google.com:19302(Google)stun:stun1.l.google.com:19302stun:stun.cloudflare.com:3478(Cloudflare)
TURN Server Setup
For reliable connections through restrictive NATs, deploy your own TURN server: Using Coturn:Redis Configuration (Signaling Server)
The signaling server uses Redis for pub/sub and multi-node scaling. Configure Redis connection in the signaling server deployment. Environment variables for signaling server:Network Architecture
Connection Flow
- Client → Matchmaker: Request available host
- Matchmaker → Client: Return host ID
- Client → Signaling: Connect via WebSocket
- Client ↔ Host: Exchange SDP/ICE through signaling
- Client ↔ Host: Establish direct WebRTC P2P connection
- Client ↔ Host: Stream video/audio, receive input
Components
Firewall and Port Configuration
Required Ports
| Service | Protocol | Port | Direction |
|---|---|---|---|
| Signaling Server | WSS | 3002 (or custom) | Inbound |
| Matchmaker | HTTPS | 3000 (or custom) | Inbound |
| STUN | UDP | 3478 | Bidirectional |
| TURN | UDP/TCP | 3478 | Bidirectional |
| WebRTC Media | UDP | 10000-65535 | Bidirectional |
Firewall Rules (Host)
Allow outbound connections:- WSS to signaling server
- HTTPS to matchmaker
- UDP for WebRTC media
Production Deployment Checklist
Use secure protocols (
wss://, https://) for all endpointsChange
hostSecret to a cryptographically secure random valueDeploy Redis with authentication enabled
Configure TURN servers for NAT traversal
Set up SSL/TLS certificates for signaling and matchmaker
Configure firewall rules to allow required ports
Set appropriate
heartbeatIntervalMs for your networkTest connections from restrictive networks (corporate, mobile)
Example Configurations
Local Development
Production Deployment
High-Availability Setup
- Multiple signaling server instances behind load balancer
- Redis cluster for high availability
- Multiple matchmaker instances
- Geographically distributed TURN servers
Troubleshooting
Cannot Connect to Signaling Server
Check:- Signaling server is running and accessible
- WebSocket URL uses correct protocol (
ws://vswss://) - Firewall allows outbound connections on signaling port
- SSL certificate is valid (for
wss://)
Host Not Appearing in Matchmaker
Check:- Matchmaker service is running
hostSecretmatches on host and matchmaker- Host can reach matchmaker URL
- Heartbeats are being sent (check logs)
- Matchmaker Redis connection is working
WebRTC Connection Fails (ICE Failed)
Check:- STUN/TURN servers are reachable
- UDP traffic is not blocked by firewall
- NAT type is compatible (symmetric NAT requires TURN)
- ICE candidate gathering completes successfully
- Consider deploying TURN server for relay
High Latency
Check:- Network RTT between client and host
- TURN relay is not being used (adds latency)
- Signaling server geographic location
- Client/host network quality
Intermittent Disconnections
Check:heartbeatIntervalMsis appropriate for network latency- Redis pub/sub is stable
- Load balancer timeout settings
- Network stability (packet loss, jitter)