This release includes a number of bug fixes and code/api housekeeping. There is a small handful of minor API breaking changes from 0.3.0. Even so, upgrading from 0.3.0 to 0.4.0 should be straight forward for all users and is highly encouraged.
Exception Type Change
The primary breaking change is the change in the type of exceptions that WebSocket++ throws. Prior to version 0.4.0 exceptions were thrown with a custom type
websocketpp::lib::error_code. This presented a number of issues, primarily relating to not deriving from the standard
std::exception base and not matching the semantics of
Starting in version 0.4.0 all exceptions thrown by WebSocket++ will be of type
websocketpp::exception which derives from
std::exception. This normalizes all exception types under the standard exception hierarchy and allows WebSocket++ exceptions to be caught in the same statement as others. The error code that was previously thrown is wrapped in the exception object and can be accessed via the
Custom Logging Policy Change
The API for building custom logging policies has been updated to be slightly more generic. In particular it no longer mandates the use of
std::ostream. As a result any custom logging policies will need to change/add a few constructors to match the new API. All logging policies bundled with WebSocket++ (the stub/none policy and the default ostream logger) have been updated. If you only use the default logging policies there are no changes you need to make.
Utility method signatures
Three utility methods have had their signatures updated. These methods are not part of WebSocket++’s public API but some users may use the bundled versions in leu of including their own libraries for convenience. If you are using any of these utility methods you may need to update your call sites: