Overview
Pion WebRTC v4.0.0 introduces several improvements and breaking changes. This guide will help you migrate your existing v3 applications to v4.For detailed release notes, visit the v4.0.0 release page on GitHub.
Import Path Changes
The most significant change in v4 is the updated import path.Update Import Statements
Change all imports from v3 to v4:Update go.mod
Update yourgo.mod file to use v4:
Dependency Updates
Pion WebRTC v4 updates several core dependencies. The following Pion packages have been updated:ICE
Updated to
github.com/pion/ice/v4DTLS
Updated to
github.com/pion/dtls/v3SRTP
Updated to
github.com/pion/srtp/v3Transport
Updated to
github.com/pion/transport/v4API Changes
While Pion maintains API compatibility where possible, some changes may require updates to your code.SettingEngine Updates
If you use theSettingEngine for custom configurations, review your settings as some methods may have updated signatures or behaviors.
Error Handling
Error types may have changed. Review your error handling code:Common Migration Issues
Build errors after updating imports
Build errors after updating imports
Make sure you’ve updated all import paths throughout your codebase:
Dependency conflicts
Dependency conflicts
Clean your module cache and update dependencies:
Type compatibility issues
Type compatibility issues
If you’re using custom types or interfaces, ensure they’re compatible with v4:
- Review the GoDoc for updated type definitions
- Check that your custom implementations satisfy updated interfaces
Testing Your Migration
Benefits of v4
Upgrading to v4 provides several advantages:- Improved Performance: Optimized packet processing and memory usage
- Enhanced Stability: Bug fixes and stability improvements
- Better Standards Compliance: Updated to latest WebRTC specifications
- Dependency Updates: Latest versions of core Pion libraries
- Go Version Support: Support for newer Go versions
Rollback Strategy
If you encounter issues during migration:Rolling Back
To rollback to v3:Getting Help
If you need assistance with migration:- Join the Pion Discord community
- Check the GitHub Discussions
- Review example applications updated for v4
- Consult the FAQ for common questions
Next Steps
Examples
Explore updated examples using v4
API Reference
Browse the complete v4 API documentation
Troubleshooting
Common issues and solutions
Community
Get help from the Pion community