Troubleshooting WebRTC Connections¶
This guide helps you diagnose and resolve common issues with WebRTC connections in FuryMesh.
Common Connection Issues¶
Unable to Establish Connection¶
If peers cannot establish a WebRTC connection:
- Check Network Configuration:
- Ensure both peers have internet connectivity
- Verify that required ports are not blocked by firewalls
-
WebRTC typically uses UDP ports 1025-65535
-
STUN/TURN Server Issues:
- Verify STUN servers are accessible
- Consider adding TURN servers for difficult NAT scenarios
-
Update your configuration:
-
NAT Traversal Problems:
- Some NAT configurations are challenging for WebRTC
- If behind symmetric NAT, TURN servers are usually required
- Check logs for ICE connectivity failures
Connection Drops Frequently¶
If connections are established but drop frequently:
- Network Stability:
- Check for network congestion or instability
-
Ensure sufficient bandwidth for transfers
-
Adjust Timeouts:
-
Increase ICE timeout for challenging networks:
-
Check Resource Usage:
- High CPU or memory usage can affect WebRTC stability
- Reduce concurrent transfers if system is overloaded
Transfer Issues¶
Slow Transfer Speeds¶
If file transfers are slower than expected:
- Adjust Chunk Size:
- Larger chunks may improve throughput on stable connections
- Smaller chunks work better on unstable connections
- Increase Concurrent Chunks:
- More concurrent transfers can improve throughput
- Network Limitations:
- Check if your network has bandwidth limitations
- WebRTC performance depends on the slowest peer's connection
Failed Transfers¶
If transfers fail to complete:
- Increase Retry Attempts:
- Adjust Retry Interval:
- Increase Idle Timeout:
- Check Logs for Specific Errors:
- Look for timeout or connection errors
- Check for chunk transfer failures
Debugging Tools¶
Enable Verbose Logging¶
Increase log verbosity to get more detailed information:
Check Connection States¶
Monitor connection states in the logs:
- New: Connection created but not active
- Connecting: ICE negotiation in progress
- Connected: Connection established
- Disconnected: Temporarily disconnected
- Failed: Connection failed
- Closed: Connection closed
Monitor Transfer Statistics¶
Use the transfer statistics to diagnose issues:
stats, err := fileManager.GetTransferStats(fileID)
if err == nil {
fmt.Printf("Transfer progress: %d/%d chunks\n",
stats.CompletedChunks, stats.TotalChunks)
fmt.Printf("Transfer rate: %.2f KB/s\n",
stats.TransferRate / 1024)
}
Advanced Troubleshooting¶
WebRTC Signaling Issues¶
If signaling fails:
- Check DHT connectivity
- Verify that signaling messages are being exchanged
- Look for errors in the signaling process
ICE Candidate Exchange Problems¶
If ICE candidates are not being exchanged properly:
- Check for firewall or NAT issues
- Verify STUN server connectivity
- Consider using TURN servers as a fallback
Data Channel Problems¶
If data channels fail to open or send data:
- Check for negotiation errors
- Verify that both peers support the data channel configuration
- Look for buffer overflow issues with large transfers
Getting Help¶
If you continue to experience issues:
- Gather detailed logs with debug level enabled
- Check the GitHub issues for similar problems
- Provide detailed information when reporting issues:
- Network configuration
- FuryMesh version
- Error messages and logs
- Steps to reproduce the issue