CppWAMP
C++11 client library for the WAMP protocol
|
Session API used by a client peer in WAMP applications. More...
#include <cppwamp/session.hpp>
Public Types | |
using | Ptr = std::shared_ptr< Session > |
Shared pointer to a Session. | |
using | State = SessionState |
Enumerates the possible states that a Session can be in. | |
using | EventSlot = AnyReusableHandler< void(Event)> |
Type-erased wrapper around a WAMP event handler. | |
using | CallSlot = AnyReusableHandler< Outcome(Invocation)> |
Type-erased wrapper around an RPC handler. | |
using | InterruptSlot = AnyReusableHandler< Outcome(Interruption)> |
Type-erased wrapper around an RPC interruption handler. | |
using | LogHandler = AnyReusableHandler< void(std::string)> |
Type-erased wrapper around a log event handler. | |
using | StateChangeHandler = AnyReusableHandler< void(SessionState)> |
Type-erased wrapper around a Session state change handler. | |
using | ChallengeHandler = AnyReusableHandler< void(Challenge)> |
Type-erased wrapper around an authentication challenge handler. | |
template<typename T , typename C > | |
using | Deduced = decltype(boost::asio::async_initiate< C, void(T)>(std::declval< GenericOp & >(), std::declval< C & >())) |
Obtains the type returned by boost::asio::async_initiate with given the completion token type C and signature void(T) . More... | |
Public Member Functions | |
virtual | ~Session () |
Destructor. More... | |
Non-copyable | |
Session (const Session &)=delete | |
Session & | operator= (const Session &)=delete |
Observers | |
AnyIoExecutor | userExecutor () const |
Obtains the fallback executor used to execute user-provided handlers. | |
AnyIoExecutor | userIosvc () const |
Legacy function kept for backward compatiblity. More... | |
IoStrand | strand () const |
Obtains the execution context in which which I/O operations are serialized. | |
SessionState | state () const |
Returns the current state of the session. | |
Modifiers | |
void | setWarningHandler (LogHandler handler) |
Sets the log handler that is dispatched for warnings. More... | |
void | setWarningHandler (ThreadSafe, LogHandler handler) |
Thread-safe setting of warning handler. More... | |
void | setTraceHandler (LogHandler handler) |
Sets the log handler that is dispatched for debug traces. More... | |
void | setTraceHandler (ThreadSafe, LogHandler handler) |
Thread-safe setting of trace handler. More... | |
void | setStateChangeHandler (StateChangeHandler handler) |
Sets the handler that is posted for session state changes. More... | |
void | setStateChangeHandler (ThreadSafe, StateChangeHandler handler) |
Thread-safe setting of state change handler. More... | |
void | setChallengeHandler (ChallengeHandler handler) |
Sets the handler that is dispatched for authentication challenges. More... | |
void | setChallengeHandler (ThreadSafe, ChallengeHandler handler) |
Thread-safe setting of state change handler. More... | |
Session Management | |
template<typename C > | |
Deduced< ErrorOr< std::size_t >, C > | connect (C &&completion) |
Asynchronously attempts to connect to a router. More... | |
template<typename C > | |
Deduced< ErrorOr< std::size_t >, C > | connect (ThreadSafe, C &&completion) |
Thread-safe connect. More... | |
template<typename C > | |
Deduced< ErrorOr< SessionInfo >, C > | join (Realm realm, C &&completion) |
Asynchronously attempts to join the given WAMP realm. More... | |
template<typename C > | |
Deduced< ErrorOr< SessionInfo >, C > | join (ThreadSafe, Realm realm, C &&completion) |
Thread-safe join. More... | |
void | authenticate (Authentication auth) |
Sends an AUTHENTICATE in response to a CHALLENGE . More... | |
void | authenticate (ThreadSafe, Authentication auth) |
Thread-safe authenticate. More... | |
template<typename C > | |
Deduced< ErrorOr< Reason >, C > | leave (C &&completion) |
Asynchronously leaves the WAMP session. More... | |
template<typename C > | |
Deduced< ErrorOr< Reason >, C > | leave (ThreadSafe, C &&completion) |
Thread-safe leave. More... | |
template<typename C > | |
Deduced< ErrorOr< Reason >, C > | leave (Reason reason, C &&completion) |
Asynchronously leaves the WAMP session with the given reason. More... | |
template<typename C > | |
Deduced< ErrorOr< Reason >, C > | leave (ThreadSafe, Reason reason, C &&completion) |
Thread-safe leave with reason. More... | |
void | disconnect () |
Disconnects the transport between the client and router. More... | |
void | disconnect (ThreadSafe) |
Thread-safe disconnect. More... | |
void | reset () |
Terminates the transport connection between the client and router. More... | |
void | reset (ThreadSafe) |
Thread-safe reset. More... | |
Pub/Sub | |
template<typename C > | |
Deduced< ErrorOr< Subscription >, C > | subscribe (Topic topic, EventSlot eventSlot, C &&completion) |
Subscribes to WAMP pub/sub events having the given topic. More... | |
template<typename C > | |
Deduced< ErrorOr< Subscription >, C > | subscribe (ThreadSafe, Topic topic, EventSlot eventSlot, C &&completion) |
Thread-safe subscribe. More... | |
void | unsubscribe (Subscription sub) |
Unsubscribes a subscription to a topic. More... | |
void | unsubscribe (ThreadSafe, Subscription sub) |
Thread-safe unsubscribe. More... | |
template<typename C > | |
Deduced< ErrorOr< bool >, C > | unsubscribe (Subscription sub, C &&completion) |
Unsubscribes a subscription to a topic and waits for router acknowledgement, if necessary. More... | |
template<typename C > | |
Deduced< ErrorOr< bool >, C > | unsubscribe (ThreadSafe, Subscription sub, C &&completion) |
Thread-safe acknowledged unsubscribe. More... | |
void | publish (Pub pub) |
Publishes an event. More... | |
void | publish (ThreadSafe, Pub pub) |
Thread-safe publish. More... | |
template<typename C > | |
Deduced< ErrorOr< PublicationId >, C > | publish (Pub pub, C &&completion) |
Publishes an event and waits for an acknowledgement from the router. More... | |
template<typename C > | |
Deduced< ErrorOr< PublicationId >, C > | publish (ThreadSafe, Pub pub, C &&completion) |
Thread-safe acknowledged publish. More... | |
Remote Procedures | |
template<typename C > | |
Deduced< ErrorOr< Registration >, C > | enroll (Procedure procedure, CallSlot callSlot, C &&completion) |
Registers a WAMP remote procedure call. More... | |
template<typename C > | |
Deduced< ErrorOr< Registration >, C > | enroll (ThreadSafe, Procedure procedure, CallSlot callSlot, C &&completion) |
Thread-safe enroll. More... | |
template<typename C > | |
Deduced< ErrorOr< Registration >, C > | enroll (Procedure procedure, CallSlot callSlot, InterruptSlot interruptSlot, C &&completion) |
Registers a WAMP remote procedure call with an interruption handler. More... | |
template<typename C > | |
Deduced< ErrorOr< Registration >, C > | enroll (ThreadSafe, Procedure procedure, CallSlot callSlot, InterruptSlot interruptSlot, C &&completion) |
Thread-safe enroll interruptible. More... | |
void | unregister (Registration reg) |
Unregisters a remote procedure call. More... | |
void | unregister (ThreadSafe, Registration reg) |
Thread-safe unregister. More... | |
template<typename C > | |
Deduced< ErrorOr< bool >, C > | unregister (Registration reg, C &&completion) |
Unregisters a remote procedure call and waits for router acknowledgement. More... | |
template<typename C > | |
Deduced< ErrorOr< bool >, C > | unregister (ThreadSafe, Registration reg, C &&completion) |
Thread-safe acknowledged unregister. More... | |
template<typename C > | |
Deduced< ErrorOr< Result >, C > | call (Rpc rpc, C &&completion) |
Calls a remote procedure. More... | |
template<typename C > | |
Deduced< ErrorOr< Result >, C > | call (ThreadSafe, Rpc rpc, C &&completion) |
Thread-safe call. More... | |
template<typename C > | |
Deduced< ErrorOr< Result >, C > | call (Rpc rpc, CallChit &chit, C &&completion) |
Calls a remote procedure, obtaining a token that can be used for cancellation. More... | |
template<typename C > | |
Deduced< ErrorOr< Result >, C > | call (ThreadSafe, Rpc rpc, CallChit &chit, C &&completion) |
Thread-safe call with CallChit capture. More... | |
void | cancel (CallChit) |
Cancels a remote procedure using the cancel mode that was specified in the Rpc. More... | |
void | cancel (ThreadSafe, CallChit) |
Thread-safe cancel. More... | |
void | cancel (CallChit, CallCancelMode mode) |
Cancels a remote procedure using the given mode. More... | |
void | cancel (ThreadSafe, CallChit, CallCancelMode mode) |
Thread-safe cancel with a given mode. More... | |
void | cancel (CallCancellation cancellation) |
Cancels a remote procedure. More... | |
void | cancel (ThreadSafe, CallCancellation cancellation) |
Thread-safe cancel. More... | |
Static Public Member Functions | |
static Ptr | create (AnyIoExecutor exec, const Connector::Ptr &connector) |
Creates a new Session instance. More... | |
static Ptr | create (AnyIoExecutor exec, const ConnectorList &connectors) |
Creates a new Session instance. More... | |
template<typename TExecutionContext > | |
static Ptr | create (TExecutionContext &context, const Connector::Ptr &connector) |
Creates a new Session instance. More... | |
template<typename TExecutionContext > | |
static Ptr | create (TExecutionContext &context, const ConnectorList &connectors) |
Creates a new Session instance. More... | |
static const Object & | roles () |
Obtains a dictionary of roles and features supported on the client side. More... | |
Session API used by a client peer in WAMP applications.
The boost::asio::io_context
passed via create()
is used when executing handler functions passed-in by the user. This can be the same, or different than the io_context
passed to the Connector
creation functions.
io_context
is used by a single-threaded app and a Session's transport, calls to undecorated methods will implicitly be within the Session's strand. If invoked from other threads, calls to undecorated methods must be executed via boost::asio::dispatch(session->stand(), operation)
. Session methods decorated with the ThreadSafe tag type may be safely used concurrently by multiple threads. These decorated methods take care of executing operations via a Session's strand so that they become sequential.using wamp::Session::Deduced = decltype( boost::asio::async_initiate<C, void(T)>(std::declval<GenericOp&>(), std::declval<C&>())) |
Obtains the type returned by boost::asio::async_initiate with given the completion token type C
and signature void(T)
.
Token Type | Deduced Return Type |
---|---|
Callback function | void |
boost::asio::yield_context | ErrorOr<Value> |
boost::asio::use_awaitable | An awaitable yielding ErrorOr<Value> |
boost::asio::use_future | std::future<ErrorOr<Value>> |
|
virtual |
Destructor.
Automatically invokes reset() on the session, which drops the connection and terminates all pending asynchronous operations.
|
static |
Creates a new Session instance.
The provided executor serves as a fallback when asynchronous operation handlers don't bind a specific executor (in lieu of using the system executor as fallback.
session->state() == SessionState::disconnected
exec | Fallback executor with which to execute user-provided handlers. |
connector | Connection details for the transport to use. |
|
static |
Creates a new Session instance.
The provided executor serves as a fallback when asynchronous operation handlers don't bind a specific executor (in lieu of using the system executor as fallback.
connectors.empty() == false
session->state() == SessionState::disconnected
error::Logic | if connectors.empty() == true |
exec | Fallback executor with which to execute user-provided handlers. |
connectors | A list of connection details for the transports to use. |
|
inlinestatic |
Creates a new Session instance.
The provided executor serves as a fallback when asynchronous operation handlers don't bind a specific executor (in lieu of using the system executor as fallback.
session->state() == SessionState::disconnected
Only participates in overload resolution when isExecutionContext<TExecutionContext>() == true
TExecutionContext | Must meet the requirements of Boost.Asio's ExecutionContext |
context | Provides executor with which to post all user-provided handlers. |
connector | Connection details for the transport to use. |
|
inlinestatic |
Creates a new Session instance.
The provided executor serves as a fallback when asynchronous operation handlers don't bind a specific executor (in lieu of using the system executor as fallback.
connectors.empty() == false
session->state() == SessionState::disconnected
error::Logic | if connectors.empty() == true |
Only participates in overload resolution when isExecutionContext<TExecutionContext>() == true
TExecutionContext | Must meet the requirements of Boost.Asio's ExecutionContext |
context | Provides executor with which to post all user-provided handlers. |
connectors | Connection details for the transport to use. |
|
static |
Obtains a dictionary of roles and features supported on the client side.
The dictionary is structured as per HELLO.Details.roles
, as desribed in the "Client: Role and Feature Announcement" section of the advanced WAMP specification.
AnyIoExecutor wamp::Session::userIosvc | ( | ) | const |
Legacy function kept for backward compatiblity.
void wamp::Session::setWarningHandler | ( | LogHandler | handler | ) |
Sets the log handler that is dispatched for warnings.
Warnings occur when the session encounters problems that do not prevent it from proceeding normally. An example of such warnings is when a peer attempts to send an event with arguments that does not match the types of a statically-typed event slot.
By default, warnings are discarded.
handler | Callable handler of type `<void (std::string)>`. |
void wamp::Session::setWarningHandler | ( | ThreadSafe | , |
LogHandler | handler | ||
) |
Thread-safe setting of warning handler.
Warnings occur when the session encounters problems that do not prevent it from proceeding normally. An example of such warnings is when a peer attempts to send an event with arguments that does not match the types of a statically-typed event slot.
By default, warnings are discarded.
handler | Callable handler of type `<void (std::string)>`. |
void wamp::Session::setTraceHandler | ( | LogHandler | handler | ) |
Sets the log handler that is dispatched for debug traces.
By default, debug traces are discarded.
handler | Callable handler of type `<void (std::string)>`. |
void wamp::Session::setTraceHandler | ( | ThreadSafe | , |
LogHandler | handler | ||
) |
Thread-safe setting of trace handler.
By default, debug traces are discarded.
handler | Callable handler of type `<void (std::string)>`. |
void wamp::Session::setStateChangeHandler | ( | StateChangeHandler | handler | ) |
Sets the handler that is posted for session state changes.
handler | Callable handler of type `<void (SessionState)>`. |
void wamp::Session::setStateChangeHandler | ( | ThreadSafe | , |
StateChangeHandler | handler | ||
) |
Thread-safe setting of state change handler.
handler | Callable handler of type `<void (SessionState)>`. |
void wamp::Session::setChallengeHandler | ( | ChallengeHandler | handler | ) |
Sets the handler that is dispatched for authentication challenges.
handler | Callable handler of type `<void (Challenge)>`. |
void wamp::Session::setChallengeHandler | ( | ThreadSafe | , |
ChallengeHandler | handler | ||
) |
Thread-safe setting of state change handler.
handler | Callable handler of type `<void (Challenge)>`. |
Deduced< ErrorOr< std::size_t >, C > wamp::Session::connect | ( | C && | completion | ) |
Asynchronously attempts to connect to a router.
The session will attempt to connect using the transports that were specified by the wamp::Connector objects passed during create(). If more than one transport was specified, they will be traversed in the same order as they appeared in the ConnectorList.
this->state() == SessionState::connecting
if successful std::error_code
if only one transport was specified and it failed to connect. completion | A callable handler of type `void(ErrorOr<size_t>)`, or a compatible Boost.Asio completion token. |
Deduced< ErrorOr< std::size_t >, C > wamp::Session::connect | ( | ThreadSafe | , |
C && | completion | ||
) |
Thread-safe connect.
The session will attempt to connect using the transports that were specified by the wamp::Connector objects passed during create(). If more than one transport was specified, they will be traversed in the same order as they appeared in the ConnectorList.
this->state() == SessionState::connecting
if successful std::error_code
if only one transport was specified and it failed to connect. completion | A callable handler of type void(ErrorOr<size_t>), or a compatible Boost.Asio completion token. |
Deduced< ErrorOr< SessionInfo >, C > wamp::Session::join | ( | Realm | realm, |
C && | completion | ||
) |
Asynchronously attempts to join the given WAMP realm.
completion | A callable handler of type void(ErrorOr<SessionInfo>) , or a compatible Boost.Asio completion token. |
this->state() == SessionState::establishing
if successful std::error_code
for protocol and transport errors. realm | Details on the realm to join. |
completion | Callable handler of type `void(ErrorOr<SessionInfo>)`, or a compatible Boost.Asio completion token. |
Deduced< ErrorOr< SessionInfo >, C > wamp::Session::join | ( | ThreadSafe | , |
Realm | realm, | ||
C && | completion | ||
) |
Thread-safe join.
completion | A callable handler of type void(ErrorOr<SessionInfo>) , or a compatible Boost.Asio completion token. |
this->state() == SessionState::establishing
if successful std::error_code
for protocol and transport errors. realm | Details on the realm to join. |
completion | Callable handler of type `void(ErrorOr<SessionInfo>)`, or a compatible Boost.Asio completion token. |
void wamp::Session::authenticate | ( | Authentication | auth | ) |
Sends an AUTHENTICATE
in response to a CHALLENGE
.
If this->state() != SessionState::authenticating
, then the authentication is discarded and not sent.
auth | Contains the authentication signature and other options. |
void wamp::Session::authenticate | ( | ThreadSafe | , |
Authentication | auth | ||
) |
Thread-safe authenticate.
If this->state() != SessionState::authenticating
, then the authentication is discarded and not sent.
auth | Contains the authentication signature and other options. |
Asynchronously leaves the WAMP session.
The "wamp.close.close_realm" reason is sent as part of the outgoing GOODBYE
message.
GOODBYE
response returned by the router. this->state() == SessionState::shuttingDown
if successful GOODBYE
response was received.std::error_code
for protocol and transport errors. completion | Callable handler of type `void(ErrorOr<Reason>)`, or a compatible Boost.Asio completion token. |
Deduced< ErrorOr< Reason >, C > wamp::Session::leave | ( | ThreadSafe | , |
C && | completion | ||
) |
Thread-safe leave.
The "wamp.close.close_realm" reason is sent as part of the outgoing GOODBYE
message.
GOODBYE
response returned by the router. this->state() == SessionState::shuttingDown
if successful GOODBYE
response was received.std::error_code
for protocol and transport errors. completion | Callable handler of type `void(ErrorOr<Reason>)`, or a compatible Boost.Asio completion token. |
Deduced< ErrorOr< Reason >, C > wamp::Session::leave | ( | Reason | reason, |
C && | completion | ||
) |
Asynchronously leaves the WAMP session with the given reason.
GOODBYE
response returned by the router. this->state() == SessionState::shuttingDown
if successful GOODBYE
response was received.std::error_code
for protocol and transport errors. reason | Reason URI and other options |
completion | Callable handler of type `void(ErrorOr<Reason>)`, or a compatible Boost.Asio completion token. |
Deduced< ErrorOr< Reason >, C > wamp::Session::leave | ( | ThreadSafe | , |
Reason | reason, | ||
C && | completion | ||
) |
Thread-safe leave with reason.
GOODBYE
response returned by the router. this->state() == SessionState::shuttingDown
if successful GOODBYE
response was received.std::error_code
for protocol and transport errors. reason | Reason URI and other options |
completion | Callable handler of type `void(ErrorOr<Reason>)`, or a compatible Boost.Asio completion token. |
void wamp::Session::disconnect | ( | ) |
Disconnects the transport between the client and router.
Aborts all pending asynchronous operations, invoking their handlers with error codes indicating that cancellation has occured.
this->state() == SessionState::disconnected
void wamp::Session::disconnect | ( | ThreadSafe | ) |
Thread-safe disconnect.
Aborts all pending asynchronous operations, invoking their handlers with error codes indicating that cancellation has occured.
this->state() == SessionState::disconnected
void wamp::Session::reset | ( | ) |
Terminates the transport connection between the client and router.
Terminates all pending asynchronous operations, which does not invoke their handlers. This is useful when a client application needs to shutdown abruptly and cannot enforce the lifetime of objects accessed within the asynchronous operation handlers.
this->state() == SessionState::disconnected
void wamp::Session::reset | ( | ThreadSafe | ) |
Thread-safe reset.
Terminates all pending asynchronous operations, which does not invoke their handlers. This is useful when a client application needs to shutdown abruptly and cannot enforce the lifetime of objects accessed within the asynchronous operation handlers.
this->state() == SessionState::disconnected
Deduced< ErrorOr< Subscription >, C > wamp::Session::subscribe | ( | Topic | topic, |
EventSlot | eventSlot, | ||
C && | completion | ||
) |
Subscribes to WAMP pub/sub events having the given topic.
ERROR
response.std::error_code
for protocol and transport errors. topic | The topic to subscribe to. |
eventSlot | Callable handler of type `void (Event)` to execute when a matching event is received. |
completion | Callable handler of type `void(ErrorOr<Subscription>)`, or a compatible Boost.Asio completion token. |
Deduced< ErrorOr< Subscription >, C > wamp::Session::subscribe | ( | ThreadSafe | , |
Topic | topic, | ||
EventSlot | eventSlot, | ||
C && | completion | ||
) |
Thread-safe subscribe.
ERROR
response.std::error_code
for protocol and transport errors. topic | The topic to subscribe to. |
eventSlot | Callable handler of type `void (Event)` to execute when a matching event is received. |
completion | Callable handler of type `void(ErrorOr<Subscription>)`, or a compatible Boost.Asio completion token. |
void wamp::Session::unsubscribe | ( | Subscription | sub | ) |
Unsubscribes a subscription to a topic.
This function can be safely called during any session state. If the subscription is no longer applicable, then the unsubscribe operation will effectively do nothing.
bool(sub) == true
error::Logic | if the given subscription is empty |
sub | The subscription to unsubscribe from. |
void wamp::Session::unsubscribe | ( | ThreadSafe | , |
Subscription | sub | ||
) |
Thread-safe unsubscribe.
This function can be safely called during any session state. If the subscription is no longer applicable, then the unsubscribe operation will effectively do nothing.
bool(sub) == true
error::Logic | if the given subscription is empty |
sub | The subscription to unsubscribe from. |
Deduced< ErrorOr< bool >, C > wamp::Session::unsubscribe | ( | Subscription | sub, |
C && | completion | ||
) |
Unsubscribes a subscription to a topic and waits for router acknowledgement, if necessary.
If there are other local subscriptions on this session remaining for the same topic, then the session does not send an UNSUBSCRIBE
message to the router.
false
if the subscription was already removed, true
otherwise. !!sub == true
std::error_code
for protocol and transport errors. error::Logic | if the given subscription is empty |
sub | The subscription to unsubscribe from. |
completion | Callable handler of type `void(ErrorOr<bool>)`, or a compatible Boost.Asio completion token. |
Deduced< ErrorOr< bool >, C > wamp::Session::unsubscribe | ( | ThreadSafe | , |
Subscription | sub, | ||
C && | completion | ||
) |
Thread-safe acknowledged unsubscribe.
If there are other local subscriptions on this session remaining for the same topic, then the session does not send an UNSUBSCRIBE
message to the router.
false
if the subscription was already removed, true
otherwise. !!sub == true
std::error_code
for protocol and transport errors. error::Logic | if the given subscription is empty |
sub | The subscription to unsubscribe from. |
completion | Callable handler of type `void(ErrorOr<bool>)`, or a compatible Boost.Asio completion token. |
void wamp::Session::publish | ( | Pub | pub | ) |
Publishes an event.
If this->state() != SessionState::established
, then the publication is discarded and not sent.
pub | The publication to publish. |
void wamp::Session::publish | ( | ThreadSafe | , |
Pub | pub | ||
) |
Thread-safe publish.
If this->state() != SessionState::established
, then the publication is discarded and not sent.
pub | The publication to publish. |
Deduced< ErrorOr< PublicationId >, C > wamp::Session::publish | ( | Pub | pub, |
C && | completion | ||
) |
Publishes an event and waits for an acknowledgement from the router.
std::error_code
for protocol and transport errors. pub | The publication to publish. |
completion | Callable handler of type `void(ErrorOr<PublicationId>)`, or a compatible Boost.Asio completion token. |
Deduced< ErrorOr< PublicationId >, C > wamp::Session::publish | ( | ThreadSafe | , |
Pub | pub, | ||
C && | completion | ||
) |
Thread-safe acknowledged publish.
std::error_code
for protocol and transport errors. pub | The publication to publish. |
completion | Callable handler of type `void(ErrorOr<PublicationId>)`, or a compatible Boost.Asio completion token. |
Deduced< ErrorOr< Registration >, C > wamp::Session::enroll | ( | Procedure | procedure, |
CallSlot | callSlot, | ||
C && | completion | ||
) |
Registers a WAMP remote procedure call.
enroll
because register
is a reserved C++ keyword. std::error_code
for protocol and transport errors. procedure | The procedure to register. |
callSlot | Callable handler of type `Outcome (Invocation)` to execute when the RPC is invoked. |
completion | Callable handler of type 'void(ErrorOr<Registration>)', or a compatible Boost.Asio completion token. |
Deduced< ErrorOr< Registration >, C > wamp::Session::enroll | ( | ThreadSafe | , |
Procedure | procedure, | ||
CallSlot | callSlot, | ||
C && | completion | ||
) |
Thread-safe enroll.
enroll
because register
is a reserved C++ keyword. std::error_code
for protocol and transport errors. procedure | The procedure to register. |
callSlot | Callable handler of type `Outcome (Invocation)` to execute when the RPC is invoked. |
completion | Callable handler of type 'void(ErrorOr<Registration>)', or a compatible Boost.Asio completion token. |
Deduced< ErrorOr< Registration >, C > wamp::Session::enroll | ( | Procedure | procedure, |
CallSlot | callSlot, | ||
InterruptSlot | interruptSlot, | ||
C && | completion | ||
) |
Registers a WAMP remote procedure call with an interruption handler.
enroll
because register
is a reserved C++ keyword. std::error_code
for protocol and transport errors. procedure | The procedure to register. |
callSlot | Callable handler of type `Outcome (Invocation)` to execute when the RPC is invoked. |
interruptSlot | Callable handler of type `Outcome (Invocation)` to execute when the RPC is interrupted. |
completion | Callable handler of type `void(ErrorOr<Registration>)`, or a compatible Boost.Asio completion token. |
Deduced< ErrorOr< Registration >, C > wamp::Session::enroll | ( | ThreadSafe | , |
Procedure | procedure, | ||
CallSlot | callSlot, | ||
InterruptSlot | interruptSlot, | ||
C && | completion | ||
) |
Thread-safe enroll interruptible.
enroll
because register
is a reserved C++ keyword. std::error_code
for protocol and transport errors. procedure | The procedure to register. |
callSlot | Callable handler of type `Outcome (Invocation)` to execute when the RPC is invoked. |
interruptSlot | Callable handler of type `Outcome (Invocation)` to execute when the RPC is interrupted. |
completion | Callable handler of type 'void(ErrorOr<Registration>)', or a compatible Boost.Asio completion token. |
void wamp::Session::unregister | ( | Registration | reg | ) |
Unregisters a remote procedure call.
This function can be safely called during any session state. If the registration is no longer applicable, then the unregister operation will effectively do nothing.
bool(reg) == true
error::Logic | if the given registration is empty |
reg | The RPC registration to unregister. |
void wamp::Session::unregister | ( | ThreadSafe | , |
Registration | reg | ||
) |
Thread-safe unregister.
This function can be safely called during any session state. If the registration is no longer applicable, then the unregister operation will effectively do nothing.
bool(reg) == true
error::Logic | if the given registration is empty |
reg | The RPC registration to unregister. |
Deduced< ErrorOr< bool >, C > wamp::Session::unregister | ( | Registration | reg, |
C && | completion | ||
) |
Unregisters a remote procedure call and waits for router acknowledgement.
false
if the registration was already removed, true
otherwise. !!reg == true
std::error_code
for protocol and transport errors. error::Logic | if the given registration is empty |
reg | The RPC registration to unregister. |
completion | Callable handler of type `void(ErrorOr<bool>)`, or a compatible Boost.Asio completion token. |
Deduced< ErrorOr< bool >, C > wamp::Session::unregister | ( | ThreadSafe | , |
Registration | reg, | ||
C && | completion | ||
) |
Thread-safe acknowledged unregister.
false
if the registration was already removed, true
otherwise. !!reg == true
std::error_code
for protocol and transport errors. error::Logic | if the given registration is empty |
reg | The RPC registration to unregister. |
completion | Callable handler of type `void(ErrorOr<bool>)`, or a compatible Boost.Asio completion token. |
Deduced< ErrorOr< Result >, C > wamp::Session::call | ( | Rpc | rpc, |
C && | completion | ||
) |
Calls a remote procedure.
std::error_code
for protocol and transport errors. rpc.withProgressiveResults() == false || std::is_copy_constructible_v<std::remove_cvref_t<C>>
error::Logic | if progressive results are enabled but the given (or generated) completion handler is not copy-constructible. |
rpc | Details about the RPC. |
completion | Callable handler of type `void(ErrorOr<Result>)`, or a compatible Boost.Asio completion token. |
Deduced< ErrorOr< Result >, C > wamp::Session::call | ( | ThreadSafe | , |
Rpc | rpc, | ||
C && | completion | ||
) |
Thread-safe call.
std::error_code
for protocol and transport errors. rpc.withProgressiveResults() == false || std::is_copy_constructible_v<std::remove_cvref_t<C>>
error::Logic | if progressive results are enabled but the given (or generated) completion handler is not copy-constructible. |
rpc | Details about the RPC. |
completion | Callable handler of type `void(ErrorOr<Result>)`, or a compatible Boost.Asio completion token. |
Deduced< ErrorOr< Result >, C > wamp::Session::call | ( | Rpc | rpc, |
CallChit & | chit, | ||
C && | completion | ||
) |
Calls a remote procedure, obtaining a token that can be used for cancellation.
std::error_code
for protocol and transport errors. rpc.withProgressiveResults() == false || std::is_copy_constructible_v<std::remove_cvref_t<C>>
error::Logic | if progressive results are enabled but the given (or generated) completion handler is not copy-constructible. |
rpc | Details about the RPC. | |
[out] | chit | [out] Token that can be used to cancel the RPC. |
completion | Callable handler of type `void(ErrorOr<Result>)`, or a compatible Boost.Asio completion token. |
Deduced< ErrorOr< Result >, C > wamp::Session::call | ( | ThreadSafe | , |
Rpc | rpc, | ||
CallChit & | chit, | ||
C && | completion | ||
) |
Thread-safe call with CallChit capture.
std::error_code
for protocol and transport errors. rpc.withProgressiveResults() == false || std::is_copy_constructible_v<std::remove_cvref_t<C>>
error::Logic | if progressive results are enabled but the given (or generated) completion handler is not copy-constructible. |
rpc | Details about the RPC. | |
[out] | chit | [out] Token that can be used to cancel the RPC. |
completion | Callable handler of type `void(ErrorOr<Result>)`, or a compatible Boost.Asio completion token. |
void wamp::Session::cancel | ( | CallChit | chit | ) |
Cancels a remote procedure using the cancel mode that was specified in the Rpc.
If this->state() != SessionState::established
, then the cancellation is discarded and not sent.
chit | Contains the request ID of the call to cancel. |
void wamp::Session::cancel | ( | ThreadSafe | , |
CallChit | chit | ||
) |
Thread-safe cancel.
If this->state() != SessionState::established
, then the cancellation is discarded and not sent.
chit | Contains the request ID of the call to cancel. |
void wamp::Session::cancel | ( | CallChit | chit, |
CallCancelMode | mode | ||
) |
Cancels a remote procedure using the given mode.
If this->state() != SessionState::established
, then the cancellation is discarded and not sent.
chit | Contains the request ID of the call to cancel. |
mode | The mode with which to cancel the call. |
void wamp::Session::cancel | ( | ThreadSafe | , |
CallChit | chit, | ||
CallCancelMode | mode | ||
) |
Thread-safe cancel with a given mode.
If this->state() != SessionState::established
, then the cancellation is discarded and not sent.
chit | Contains the request ID of the call to cancel. |
mode | The mode with which to cancel the call. |
void wamp::Session::cancel | ( | CallCancellation | cancellation | ) |
Cancels a remote procedure.
If this->state() != SessionState::established
, then the cancellation is discarded and not sent.
cancellation | Contains the request ID and other options. |
void wamp::Session::cancel | ( | ThreadSafe | , |
CallCancellation | cancellation | ||
) |
Thread-safe cancel.
If this->state() != SessionState::established
, then the cancellation is discarded and not sent.
cancellation | Contains the request ID and other options. |