Upgrade Guide¶
This guide is designed to help users seamlessly transition from Best HTTP/2 to the new major release (v3.x). If you're updating your package, please read through the relevant sections to ensure a smooth upgrade.
Pre-upgrade Checklist¶
- Backup Your Project: Always create a backup of your entire project before starting the upgrade process. This allows you to revert changes if something goes awry.
- Review Deprecated Features: Check if you're using any features or methods that were marked as deprecated in the last release. Transition away from these first.
Post-upgrade Steps¶
- Update API Calls: If the new version introduced new methods or altered existing ones, update your calls accordingly.
- Test Extensively: After upgrading, test all functionalities in your project that utilize the Best WebSockets package to ensure they work as expected.
List of Breaking Changes¶
I have worked hard to enhance features, fix issues, and introduce new capabilities - here's what you need to know:
1. Namespace changes¶
Instead of one big package the new version is split into multiple packages. This packaging change is reflected in how the plugins' namespaces are named. WebSockets got its own namespace Best.WebSockets
, upgrading namespace usings can be done by replacing BestHTTP.WebSocket
to Best.WebSockets
.
Example
new BestHTTP.WebSocket.WebSocket(new Uri(address));
new Best.WebSockets.WebSocket(new Uri(address));
2. Renamed StartPingThread property¶
The StartPingThread
property's naming doesn't reflected its behavior, it isn't starts a new thread.
Example
3. Merged OnError and OnClosed events¶
Two handlers for similiar events was a common source of confusion among users. Now the WebSocket class has only an OnClosed
event and its code parameter indicates whether it was an error or not.
Additionally OnClosed
's code
parameters is now a WebSocketStatusCodes enum.
Example
4. OnBinaryNoAlloc & OnBinary event changes¶
The OnBinary
event receives a BufferSegment
containing information about the received binary data. The received segment must be processed in the OnBinary
event handler because after the call it's released back the the BufferPool, or copied into a new buffer.
Example
OnBinaryNoAlloc
event is removed, use OnBinary
instead.
General Tips¶
- Stay Updated on Documentation: Keep an eye on the official documentation for the Best WebSockets package. It's regularly updated with new information, tutorials, and solutions to common problems.
- Engage with the Community: Join discussions on our Community and Support page to share your experiences, ask questions, and get advice on the upgrade process.
- Check for Updates Regularly: Ensure you always have the latest features, improvements, and bug fixes by regularly checking for updates.