Updated UML diagrams.
Polymorphic codecs and transports.
- Session is now a move-only type that can be instantiated on the stack.
- Deprecated
Session::create. - Added
ConnectionWishandConnectionWishListwhich should now be used in place of the oldConnectionandConnectionListclasses. - Passing
ConnectionWishandConnectionWishListviaSession::connectis now preferred over passing the legacyConnectorinstances viaSession::create. TcpHostandUdsPathnow havewithFormatmethods which generate aConnectionWishthat can be passed toSession.- The
authenticate,publish, 'yield', andcancelmethods ofSessionnot taking a completion handler now return anErrorOrDone. The thread-safe overloads for those now return astd::future<ErrorOrDone>. - AnyCompletionExecutor is now used by session to contain the user executor.
- Added
Session::ongoingCallfor progressive call results, which automatically appliesrpc.withProgessiveResults(true). - Renamed
Session::resettoSession::terminate, leaving the former as a deprecated alias. - Renamed
Session::userExecutortoSession::fallbackExecutor, leaving the former as a deprecated alias. Session::fallbackExecutortype relaxed toAnyCompletionExecutor.- Handlers registered via
Session'ssetWarningHandler,setTraceHandler, andsetStateChangeHandlerwill no longer be fired afterSession::terminateis called and beforeSession::connectis called. - Added
wamp::spawnandwamp::yield_contextin<cppwamp/spawn.hpp>, which are aliases to their Boost.Asio counterparts. - Added
wamp::spawnCompletionHandlerandwamp::CompletionYieldContextto support spawning coroutines viaEvent::executorandInvocation::executor. - When
CPPWAMP_USE_COMPLETION_YIELD_CONTEXTis defined, wamp::BasicYieldContextwamp::AnyCompletionExecutor will be passed to coroutines spawned via Event/Invocation unpackers. The relaxes the requirement that theSession::userExecutor()originate fromboost::asio::io_context. - When
CPPWAMP_USE_COMPLETION_YIELD_CONTEXTandASIO_DISABLE_BOOST_COROUTINEare defined, the coroutine Event/Invocation unpackers will use the new Boost.Context-based coroutines introduced in Boost 1.80.0. Please note this bug in Boost 1.80.0 concerning exceptions thrown from these new Boost.Context-based coroutines. - Instead of throwing an exception,
Sessionnow emits aTransportErrc::badTxLengtherror via the completion handler or return value when the payload exceeds the transport's limit. Challenge::authenticate,Invocation::yieldandInterruption::yieldnow have thread-safe and non-thread-safe overloads.- Added
SessionErrcerror codes corresponding to new predefined error URIs that have appeared in the WAMP spec. - Added
Session::setLogHandlerwhich takes a handler of typevoid (LogEntry)and unifies all log event handling. - Added
Session::setLogLevelfor use withSession::setLogHandler. - Renamed
AsioContexttoIoContext, leaving the former as a deprecated alias. - Deprecated
AsioErrorCode. - Deprecated
ProtocolErrcandProtocolCategoryin favor ofSessionErrc::protocolViolation. - Deprecated
Session::setWarningHandlerandSession::setTraceHandlerin favor ofSession::setLogHandler.
Implementation improvements:
- Adding more codecs or transports in the future will no longer result in a combinatorial explosion of explicit template instantions due to the number of transport/codec combinations.
- Codecs are now specializations of
SinkEncoderandSourceDecoder. - Simplified codec tags to only provide their numeric ID.
- Added
AnyCodecpolymorphic wrapper for codecs. - Added
Transportinginterface class which replaces the old Transport type requirement. internal::Clientis now non-templated and is retained bySessionduring the latter's lifetime.Session::connectlogic has been moved tointernal::Client.- Renamed
internal::AsioTransporttointernal::RawsockTransportand simplified its previously convoluted design. internal::RawsockConnectorandinternal::RawsockTransportnow use policy classes instead of polymorphism to alter their behavior for tests.- Tidying of transport tests.
internal::Peercomposition instead of inheritance.- Avoid unnecessary
boost::asio::postin intermediate handlers.
Session::callcan no longer be used for progessive call results, useSession::ongoingCallinstead.- The
Sessiondestructor now automatically invokesSession::disconnectinstead ofSession::terminate, to better emulate the cancellation behavior of Asio sockets being destroyed. Event::executorandInvocation::executorcan no longer be directly used by Boost.Coroutine-basedboost::asio::spawnto spawn coroutines. See workaround below in the Migration Guide.- The undecorated
Challenge::authenticate,Invocation::yieldandInterruption::yieldare no longer thread-safe. See Migration Guide below.
- Replace
Session::create(args...)with std::make_shared(args...), or instantiate Session as a stack or member variable. - Replace
connection<TCodec>(TcpHost)withTcpHost::withFormat. E.g.:wamp::TcpHost{"localhost", 12345}.withFormat(wamp::json) - Replace
Session::callwithSession::ongoingCallwhen progressive results are desired. - Replace
Session::resetwithSession::terminate. - Replace
Session::userExecutorwithSession::fallbackExecutor - Manually call
Session::terminatebefore aSessionis destroyed if you must suppress the execution of pending completion handlers. - Replace
AsioContextwithIoContext. - When using
Event::executororInvocation::executorto spawn coroutines, usewamp::spawnCompletionHandlerinstead ofboost::asio::spawn. - When calling
Challenge::authenticate,Invocation::yieldandInterruption::yieldfrom multiple threads, use the new overloads taking theThreadSafetag type. - If checking for
ProtocolErrcerrors specifically, check forSessionErrc::protocolViolationinstead. - Replace
Session::setWarningHandlerandSession::setTraceHandlerwithSession::setLogHandlerandSession::setLogLevel.
Asio completion token support and thread-safe Session operations.
- All asynchronous operations in Session now accept a generic
completion token,
which can either be a callback function, a
yield_context,use_awaitable, oruse_future. - C++20 coroutines now supported by Session.
- Added examples using Asio stackless coroutines, C++20 coroutines, and std::future.
- Migrated from
AsyncResultto newErrorOrclass which better emulates the proposedstd::expected. Session's asynchonous operations now return anErrorOrresult when passed ayield_contextas the completion token, and will not throw if there was a runtime error.ErrorOr::valuemust be called to obtain the operation's actual result (or throw an exception if there was an error).- Added
Session::strandso that users may serialize access to theSessionwhen using a thread pool. - Added
Sessionoverloads with theThreadSafetag type which can be called concurrently by multiple threads. These overloads will be automatically dispatch operations via theSession's execution strand. - Added the
SessionErrc::invalidStateenumerator which is now used to report errors when attempting to performSessionoperations during an invalid session state. - Renamed
AnyExecutortoAnyIoExecutorwhich aliasesboost::asio::any_io_executor. AnyExecutor is now deprecated. - Added
AnyReusableHandlerwhich type-erases a copyable multi-shot handler, while storing the executor to which it is possibly bound. - Added
AnyCompletionHandlerwhich is a Boost-ified version of the prototype [asio::any_completion_handler] (chriskohlhoff/asio#1100). - Added
AnyCompletionExecutorwhich is a Boost-ified version of the prototypeasio::any_completion_executor. - Session and transports now extract a
strand
from the
Connectorpassed by the user. - Moved corounpacker implementation to header directory root.
- Added
Realm::captureAbort. - Made config.hpp a public header.
- Added DecodingErrc and DecodingCategory for deserialization errors not covered by jsoncons.
Session'ssetWarningHandler,setTraceHandler,setStateChangeHandler, andsetChallengeHandlernow take effect immediately even when connected.Session's handlers forsetWarningHandler,setTraceHandler,setStateChangeHandler, andsetChallengeHandlerare now executed viaSession::userExecutorby default.- Boost.Asio [cancellation slot]
(https://www.boost.org/doc/libs/release/doc/html/boost_asio/overview/core/cancellation.html)
support for
Session::call. - Added
Rpc::withCancelModewhich specifies the cancel mode to use when triggered by Asio cancellation slots. - Added
withArgsTuple,convertToTupleandmoveToTupleto Payload class. - Added the
Defermenttag type (withdefermentconstexpr variable) to more conveniently return a deferredOutcome` from an RPC handler. - Renamed
CancellationtoCallCancellation.Cancellationis now a deprecated alias to ``CallCancellation`. - Renamed
CancelModetoCallCancelMode.CancelModeis now a deprecated alias toCallCancelMode. - Renamed
Basic[Coro]<Event|Invocation>UnpackertoSimple[Coro]<Event|Invocation>Unpacker, with the former kept as deprecated aliases. - Renamed
basic[Coro]<Event|Rpc>tosimple[Coro]<Event|Rpc>, with the former kept as deprecated aliases. - Renamed the CppWAMP::coro-headers CMake target to CppWAMP::coro-usage, leaving the former as an alias.
- Deprecated
CoroSessionandAsyncResult. - Deprecated
error::Decode - Deprecated the
Session::canceloverloads takingCallCancellation. - Deprecated
Outcome::deferred.
- Bumped Boost version requirements to 1.77 to support Asio cancellation slots.
- Errors due to attempting to perform an asynchronous
Sessionoperation during an invalid state are now emitted via theErrorOrpassed to the handler, instead of throwingerror::Logic. This is to avoiderror::Logicexceptions being thrown due to race conditions outside the library user's control (for example, calling a remote procedure just as the peer terminates the session). This also avoids the complications involved in transporting exceptions to coroutines, as well as having two mechanisms for reporting errors from the same function. Session::authenticateno longer throws if the session is not in theSessionState::authenticatingstate. Instead, the authentication is discarded and a warning is emitted.Session::publish(Pub)no longer throws if the session is not in theSessionState::establishedstate. Instead, the publicatioon is discarded and a warning is emitted.Session::cancelno longer throws if the session is not in theSessionState::establishedstate. Instead, the cancellation is discarded and a warning is emitted.- Numeric values of enumerators following
SesesionErrc::invalidStatehave been bumped by one. Session::callno longer returns the request ID. To obtain the request ID, use the newSession::calloverload which takes aCallChitout parameter by reference.- The signature of
lookupWampErrorUrihas been changed so that it returns whether the corresponding error code was found. - Codec decoders now return a std::error_code instead of throwing an exception.
- The
Transporttype requirement has been changed so that it provides aboost::asio::strandinstead of aboost::asio::any_executor.
- Replace
AnyExecutorwithAnyIoExecutor. - Replace
AsyncResultwithErrorOr. - Replace
AsyncResult::getwithErrorOr::value. - Replace
AsyncResult::errorCodewithErrorOr::error. - Replace
AsyncResult::setValuewithErrorOr::emplace. - Replace
Basic[Coro]<Event|Invocation>UnpackerwithSimple[Coro]<Event|Invocation>Unpacker - Replace
basic[Coro]<Event|Rpc>withsimple[Coro]<Event|Rpc> - Replace
CancellationwithCallCancellation - Replace
CancelModewithCallCancelMode - Replace
CoroSession<>withSession. - Replace
Outcome::deferredwithdeferment. - Replace
#include <cppwamp/corosession.hpp>with#include <boost/asio/spawn.hpp>and#include <cppwamp/session.hpp>. - Add
.value()toSessionmethods taking ayield_contextto preserve the old behavior where either the result value is returned upon success or an exception is thrown upon failure. std::error_codepointers cannot be passed to the the consolidatedSessionclass. Instead check the returnedErrorOrresult viaoperator boolandAsyncResult::error().Session::callno longer returns the RPC request ID. Instead use theSession::calloverload which takes aCallChitout parameter by reference. Alternatively, you may bind an Asio cancellation slot to the completion token.- Replace
Session::cancel(CallCancellation)usages withSession::cancel(CallChit). - If used directly, check the
std::error_codereturned by codec decoders instead of catchingerror::Decodeexceptions. - Replace the
CppWAMP::coro-headersCMake target withCppWAMP::coro-usage.
Fixed the non-compilation of examples.
Add -fPIC when building vendorized static Boost libraries.
Migrated to jsoncons for all serialization.
- Support for CBOR has been added.
- Codecs have been split into encoders and decoders that can be instantiated and reused for multiple encoding/decoding operations.
- Simplified passing of encoded WAMP messages between Peer and AsioTransport.
- Added
toStringfree functions for dumpingVariant,Array, andObjectas a JSON-formattedstd::string.
- The
Codectype requirements have changed. It affects those who used codecs to encode/decode variants outside of theSessionAPIs. This also affects those who have extended CppWAMP to use their own custom codecs. - The
Transporttype requirements have changed. It affects those who extended CppWAMP to use their own custom transports. - Variant instances are output as true JSON via
operator(ostream&, const Variant&). That means strings variants are now output with quotes. Blob variants are now also output with quotes, along with a \u0000 prefix, as if they were being transmitted over WAMP. - Session warnings no longer output to
std::cerrby default.Session::setWarningHandlermust be explicitly called to re-enable this behavior.
Refactored WAMP message processing.
- Payloads/options for Session commands are now directly stored in WampMessage
- Added WampMessage subclasses responsible for marshalling message fields
- Consolidate peer/session data objects to the same C++ module
- Print WAMP message names in traces
- Defunct HEARTBEAT message no longer recognized as valid
- More selective inclusion of Msgpack-c headers
- Add config for older Crossbar versions (for unit tests)
- Perform move capture wherever possible
- Perform automatic enum<->variant conversions while allowing custom conversion of specific enum types
- Callbacks can now be registered for session state change events
- Added caller-initiated timeout support
- Support progressive call results for caller
- Added authentication tutorial
- Enriched authentication-related API to handle CRA and SCRAM (user must still compute cryto signatures using a 3rd party library)
- Added example programs using the async API
- Added more practical examples of scoped registrations/subscriptions in documentation
- Added session logging tutorial
- Added example of converting nested objects in documentation
- Added session leave overloads that don't require a Reason
Migrated to newer Boost.Asio, CMake, and Catch.
- Migrated to newer Boost.Asio: Boost 1.74 or above now required.
- Removed Boost.Endian dependency.
- Migrated test framework to Catch2: version 2.3 or greater now required.
- RapidJSON and Msgpack-c dependencies are no longer mandatory if their respective codecs are not needed.
- CMake minimum version is now 3.12.
- Migrated to newer Doxygen for generating docs (tested with version 1.8.17)
- Overhauled CMake build to adopt modern practices.
- CMake package config now provided when built and installed.
- Separate CMake targets now provided for easy import into another CMake project:
CppWAMP::headers,CppWAMP::core,CppWAMP::json,CppWAMP::msgpack, andCppWAMP::coro.
AsioServicenow aliasesboost::asio::io_contextiosvc()method inEvent,Invocation, andInterruptionreplaced withexecutor()method.- Signed/unsigned comparisons of numeric
Variantsare now performed correctly (in the mathematical sense). - Removed the following deprecated methods:
Pub::withBlacklist,Pub::withWhiteList,Rpc::withBlacklist,Rpc::withWhitelist,Rpc::withExcludeMe
- Added API visibility macros for shared library builds.
Session,CoroSession, andconnect(...)now have overloads that accept boost::asio::any_executor.- Added
TcpOptionsandUdsOptionswhich encapsulate socket options. TcpHostandUsdPathnow prefer to take socket options viaTcpOptionsandUdsOptionsrespectively in their constructors.- Allow passing
SO_OOBINLINEsocket option. wamp::ValueTypeOfnow mimicsstd::remove_cvref_tinstead ofstd::decay_t.
- Removed git submodules in favor of CMake FetchContent.
- Removed vestigial Qt Creator and Mercurial stuff.
- Fixed json.hpp and msgpack.hpp leaking internals in
CPPWAMP_COMPILED_LIBmode. - Removed CPPWAMP_TESTING_FOO macros in favor of Catch2 runtime tags.
- WAMP tests now use any available codec.
- Made header files self-contained to avoid clangd error messages.
- Fixed
-Wallwarnings. - An
AUTHENTICATEmessage with empty signature is now sent to a router if aCHALLENGEmessage is received and there is no registered challenge handler. This is to prevent deadlocking. - Installation directions are now in README instead of GitHub wiki.
- Tutorials are now located in repo instead of GitHub wiki.
Update for latest 3rd-party dependencies.
- Updated 3rd-party subrepos.
- Fixed missing RawNumber for RapidJSON parser (fixes #100).
- Added missing spaces in conversion exception messages (fixes #101).
Variant conversion enhancements.
- ConversionAccess can now access private default constructors (closes #98).
- To/FromVariantConverter now throws error::Conversion exclusively.
- All RPC argument conversion failures are now propagated back to caller (fixes #97).
- Added test cases for bad From/ToVariantConverter conversions.
- Enforced Client::LocalSubs non-empty invariant during unsubscribe.
- Added Variant::at accessors (closes #95).
- Updated config.json test/example files for Crossbar 0.13.0.
- Blob is now stored via a pointer within the Variant::Field union, to reduce the size of a Variant object.
Bug fixes.
- Fixed encoding of multibyte UTF-8 sequences to JSON (fixes #96).
- Added test case for converting multibyte UTF-8 sequences to JSON.
Better support for asynchronous RPC and event handlers.
Breaking Changes:
SessionandCoroSessionnow take an extraboost::asio::io_serviceargument in theircreate()functions. This IO service is now used for executing user-provided handlers. It can be the same one used by the transport connectors.- Support for non-handshaking raw socket transports has been removed (closes #92).
Enhancements:
- Added
basicCoroRpc(),basicCoroEvent(),unpackedCoroRpc(), andunpackedCoroEvent()wrappers, which execute a call/event slot within the context of a coroutine. This should make it easier to implement RPC/event handlers that need to run asynchronously themselves (closes #91). InvocationandEventnow have aniosvc()getter, which returns the user-providedasio::io_service(closes #91).- Added
Variantconversion facilities forstd::setandset::unordered_set.
Fixes and enhancements.
- Added support for binary WAMP payloads (closes #50)
- Fixed wrong header guard in <cppwamp/types/unorderedmap.hpp> (fixes #73)
- Added
SessionErrcmappings to new predefined error URIs added to the spec (closes #77) - Added recently proposed
exclude_authid,exclude_authrole,eligible_authid,eligible_authroleoptions (closes #80). - Fixed
ScopedRegistrations andScopedSubscriptions that weren't being moved properly (fixes #82). - Added
basicRpcandbasicEventfunctions.basicRpcallows the registration of statically-typed RPC handlers that don't take anInvocationparameter and don't return anOutcomeresult. Likewise,basicEventallows the registration of statically-typed event handlers that don't take anEventparameter (closes #84).
More fixes for v0.5.0 release.
- Fixed JSON encoding of control characters (fixes #72)
- Added test case for converting derived DTO classes (see #70)
Minor fixes and enhancements to v0.5.0 release.
- Fixed namespace-related errors that occur for user-defined conversions.
- Can now specify a fallback value when extracting an object member during conversion.
- Added Rpc::captureError which allows users to retrieve ERROR message details returned by a callee.
- Variant-to-Variant conversion is now handled properly.
User-defined type support.
- Users may now register custom types that can be converted to/from
Variant. These registered custom types may be passed directly to RPC and pub/sub operations and handlers. See Custom Variant Conversions in the tutorial for usage examples (closes #69). timeserviceandtimeclientexamples have been provided which showcase the use of conversion facilities. These examples use the CppWAMP library in a header-only fashion (closes #67).- Converters have been provided for
std::unordered_mapandboost::optional(closes #68).
Payload::withArgsnow takes variadic arguments, instead of astd::initializer_list<Variant>. This change makes it possible for registered user-defined types to be automatically converted toVariant. Wherever you doRpc("foo").withArgs({"hello", 42})should be changed toRpc("foo").withArgs("hello", 42)(notice the removed curly braces).std::tuplesupport is now provided via the new conversion facilities, in<cppwamp/types/tuple.hpp>.
- Fixed compile errors that occur only when the library is used in a header-only fashion.
Connection API improvements.
TcpConnectorandUdsConnectorhave been replaced withconnectorfactory functions in<cppwamp/tcp.hpp>and<cppwamp/uds.hpp>. The new interface uses a fluent API which allows the user to specifysetsockoptsocket options (closes #63). Consult the revised tutorials and documentation to learn how to migrate your app code to the revised connection interface.- Revised connection API so that unused serialization libraries are not needed when using CppWAMP in a header-only fashion (fixes #64).
- Raw socket transports now use 16MB as the default maximum length for incoming messages (closes #39).
Fixes and additional tests.
- Added as many test cases as possible for supported advanced WAMP features. Some features cannot be tested because they are not supported on Crossbar, or they are not "symmetrically" supported on CppWAMP (closes #43).
- Added test cases where asynchronous Session operations are executed within call/event slots (closes #44).
- Made changes to allow building with Clang on OS X (thanks taion!) (fixes #55).
- Added test case for constructing
Variantfromstd::vector(closes #58). Rpc,Procedure,Pub,Topic, and friends now have converting (implicit) constructors (closes #60).- NaN and infinite
Realvalues are now encoded asnullover JSON (fixes #61). - Fixed
unpackedEventandunpackedRpcso that they can take a lambda functions by value. - Reorganized
wamptest.cppso that related test cases are grouped inSCENARIOblocks. The Crossbar router process can no longer be forked from the test suite because of this.
Made further refinements to the API. The minimal Boost library version required is now 1.58.0.
- The library now depends on Boost 1.58, which now includes Boost.Endian. This removes the dependency on the "standalone" Boost.Endian (closes #5).
- Revamped subscriptions and registrations to more closely model Boost.Signals2 connection management. Users are no longer forced to keep
Subscription/Registrationobjects alive.ScopedSubscriptionandScopedRegistratonhave been added to permit automatic lifetime management, if desired (closes #45). - RPC handlers are now required to return an
Outcomeobject. This makes it harder to forget returning a result from within an RPC handler (closes #46). - Statically-typed call/event handlers are now handled by
EventUnpackerandInvocationUnpackerwrappers. This eliminates the need forSession::subscribeandSession::enrolloverloads, and greatly simplifies subscription/registration management (closes #51). - Unpacking of positional arguments for statically-typed call/event slots now uses a simpler technique inspired by
std::integer_sequence(closes #52) - Updated examples and tests to use raw socket handshaking, which is now supported on Crossbar (closes #54).
Overhauled API to make use of fluent API techniques. Some Advanced WAMP Profile features are now supported.
- Renamed some classes:
Client->SessionCoroClient->CoroSessioninternal::Session->internal::Dialogueinternal::ClientImplBase->internal::ClientInterfaceinternal::ClientImpl->internal::Client
- Removed the
Argsclass, as similar functionality is now provided byPayloadwith a cleaner API - Folded
CoroErrcClientintoCoroClient(nowSessionClient) by taking an extra, optionalstd::error_codepointer Session(formerlyClient) now makes extensive use of fluent API techniques, via data objects declared in<cppwamp/dialoguedata.hpp>and<cppwamp/sessiondata.hpp>(fixes #6, fixes #7, fixes #34)SubscriptionandRegistrationare now returned via shared pointer, and are no longer "handle" objects that mimic a shared pointer (fixes #40).- Added
operator[]support toVariant, to make it more convenient to access elements/members. - Added
Variant::valueOrto make it easier to treat a Variant as an optional value. - Added support for the "low-hanging fruit" among advanced WAMP features. These are features that only require some
DetailsorOptionsattributes to be set, and require no other special treatment by the client (fix #10, fix #11, fix #12, fix #13, fix #14, fix #15, fix #23, fix #24, fix #25, fix #26, fix #27, fix #35, fix #37, fix #38):- General: agent identification, feature announcement
- Callee:
call_trustlevels,caller_identification,pattern_based_registration, progressive_call_results - Caller:
call_timeout,callee_blackwhite_listing,caller_exclusion,caller_identification - Publisher:
publisher_exclusion,publisher_identification,subscriber_blackwhite_listing - Subscriber:
pattern_based_subscription,publication_trustlevels,publisher_identification
Initial public release.
Copyright © Butterfly Energy Systems, 2014-2015