Representation of a WAMP session. More...
#include <wamp_session.hpp>

Public Member Functions | |
wamp_session (boost::asio::io_service &io_service, bool debug_enabled=false) | |
Create a new WAMP session. More... | |
boost::future< void > | start () |
Establishes a session with the router. More... | |
boost::future< void > | stop () |
Stops the session with the router. More... | |
boost::future< uint64_t > | join (const std::string &realm, const std::vector< std::string > &authmethods=std::vector< std::string >(), const std::string &authid="") |
Join a realm with the session. More... | |
boost::future< std::string > | leave (const std::string &reason=std::string("wamp.error.close_realm")) |
Leave the realm. More... | |
boost::future< void > | publish (const std::string &topic, const wamp_publish_options &options=wamp_publish_options()) |
Publish an event with empty payload to a topic. More... | |
template<typename List > | |
boost::future< void > | publish (const std::string &topic, const List &arguments, const wamp_publish_options &options=wamp_publish_options()) |
Publish an event with positional payload to a topic. More... | |
template<typename List , typename Map > | |
boost::future< void > | publish (const std::string &topic, const List &arguments, const Map &kw_arguments, const wamp_publish_options &options=wamp_publish_options()) |
Publish an event with both positional and keyword payload to a topic. More... | |
boost::future< wamp_subscription > | subscribe (const std::string &topic, const wamp_event_handler &handler, const wamp_subscribe_options &options=wamp_subscribe_options()) |
Subscribe a handler to a topic to receive events. More... | |
boost::future< void > | unsubscribe (const wamp_subscription &subscription) |
Unubscribe a handler to previously subscribed topic. More... | |
boost::future< wamp_call_result > | call (const std::string &procedure, const wamp_call_options &options=wamp_call_options()) |
Calls a remote procedure with no arguments. More... | |
template<typename List > | |
boost::future< wamp_call_result > | call (const std::string &procedure, const List &arguments, const wamp_call_options &options=wamp_call_options()) |
Calls a remote procedure with positional arguments. More... | |
template<typename List , typename Map > | |
boost::future< wamp_call_result > | call (const std::string &procedure, const List &arguments, const Map &kw_arguments, const wamp_call_options &options=wamp_call_options()) |
Calls a remote procedure with positional and keyword arguments. More... | |
boost::future< wamp_registration > | provide (const std::string &uri, const wamp_procedure &procedure, const provide_options &options=provide_options()) |
Register a procedure that can be called remotely. More... | |
boost::future< void > | unprovide (const wamp_registration ®istration) |
Unregister a handler to previosly registered service. More... | |
virtual boost::future< wamp_authenticate > | on_challenge (const wamp_challenge &challenge) |
Function called by the session when authenticating. More... | |
const std::unordered_map< std::string, msgpack::object > & | welcome_details () |
Accessor method to WELCOME DETAILS dictionary containing router roles and corresponding features, authid, authrole, ...) More... | |
![]() | |
virtual | ~wamp_transport_handler ()=default |
Default virtual destructor. | |
Detailed Description
Representation of a WAMP session.
Definition at line 88 of file wamp_session.hpp.
Constructor & Destructor Documentation
autobahn::wamp_session::wamp_session | ( | boost::asio::io_service & | io_service, |
bool | debug_enabled = false |
||
) |
Create a new WAMP session.
- Parameters
-
io_service The io service to drive event dispatching. debug_enabled Whether or not to run in debug mode.
Member Function Documentation
boost::future<wamp_call_result> autobahn::wamp_session::call | ( | const std::string & | procedure, |
const wamp_call_options & | options = wamp_call_options() |
||
) |
Calls a remote procedure with no arguments.
- Parameters
-
procedure The URI of the remote procedure to call. options The options to pass in the call to the router.
- Returns
- A future that resolves to the result of the remote procedure call.
boost::future<wamp_call_result> autobahn::wamp_session::call | ( | const std::string & | procedure, |
const List & | arguments, | ||
const wamp_call_options & | options = wamp_call_options() |
||
) |
Calls a remote procedure with positional arguments.
- Parameters
-
procedure The URI of the remote procedure to call. arguments The positional arguments for the call. options The options to pass in the call to the router.
- Returns
- A future that resolves to the result of the remote procedure call.
boost::future<wamp_call_result> autobahn::wamp_session::call | ( | const std::string & | procedure, |
const List & | arguments, | ||
const Map & | kw_arguments, | ||
const wamp_call_options & | options = wamp_call_options() |
||
) |
Calls a remote procedure with positional and keyword arguments.
- Parameters
-
procedure The URI of the remote procedure to call. arguments The positional arguments for the call. kw_arguments The keyword arguments for the call. options The options to pass in the call to the router.
- Returns
- A future that resolves to the result of the remote procedure call.
boost::future<uint64_t> autobahn::wamp_session::join | ( | const std::string & | realm, |
const std::vector< std::string > & | authmethods = std::vector< std::string >() , |
||
const std::string & | authid = "" |
||
) |
Join a realm with the session.
- Parameters
-
realm The realm to join on the application router. authmethods The authentication methods this instance support e.g. "wampcra","ticket" authid The username or maybe an other identifier for the user to join.
- Returns
- A future that resolves with the session ID when the realm was joined.
boost::future<std::string> autobahn::wamp_session::leave | ( | const std::string & | reason = std::string("wamp.error.close_realm") | ) |
Leave the realm.
- Parameters
-
reason An optional WAMP URI providing a reason for leaving.
- Returns
- A future that resolves with the reason sent by the peer.
|
virtual |
Function called by the session when authenticating.
It always has to be re-implemented (if authentication is part of the system).
- Parameters
-
challenge The challenge from the router containing enough information for the system to prove membership.
- Returns
- A future that resolves to an authentication response.
boost::future<wamp_registration> autobahn::wamp_session::provide | ( | const std::string & | uri, |
const wamp_procedure & | procedure, | ||
const provide_options & | options = provide_options() |
||
) |
Register a procedure that can be called remotely.
- Parameters
-
uri The URI associated with the procedure. procedure The procedure to be exposed as a remotely callable procedure. options Options for registering the procedure.
- Returns
- A future that resolves to a autobahn::registration
boost::future<void> autobahn::wamp_session::start | ( | ) |
Establishes a session with the router.
- Returns
- A future that indicates if the session was successfully started.
boost::future<void> autobahn::wamp_session::stop | ( | ) |
Stops the session with the router.
- Returns
- A future that indicates if the session was successfully stopped.
boost::future<wamp_subscription> autobahn::wamp_session::subscribe | ( | const std::string & | topic, |
const wamp_event_handler & | handler, | ||
const wamp_subscribe_options & | options = wamp_subscribe_options() |
||
) |
Subscribe a handler to a topic to receive events.
- Parameters
-
topic The URI of the topic to subscribe to. handler The handler that will receive events under the subscription. options The options to pass in the subscribe request to the router.
- Returns
- A future that resolves to the autobahn::subscription.
boost::future<void> autobahn::wamp_session::unprovide | ( | const wamp_registration & | registration | ) |
Unregister a handler to previosly registered service.
- Parameters
-
registration The registration to unregister.
- Returns
- A future that resolves to the unregistered response.
boost::future<void> autobahn::wamp_session::unsubscribe | ( | const wamp_subscription & | subscription | ) |
Unubscribe a handler to previously subscribed topic.
- Parameters
-
subscription The subscription to unsubscribe from.
- Returns
- A future that resolves to the unsubscribed response.
const std::unordered_map<std::string, msgpack::object>& autobahn::wamp_session::welcome_details | ( | ) |
Accessor method to WELCOME DETAILS dictionary containing router roles and corresponding features, authid, authrole, ...)
- Returns
- A dictionary of objects received with WELCOME message upon joining. i.e. { "realm": "<string>", "authprovider": "dynamic", "roles": { "broker": { "features": { "publisher_identification": true, "pattern_based_subscription": true, ... } }, "dealer": { "features": { "pattern_based_registration": true, "progressive_call_results": true, ... } } }, "authid": "<assigned authid>", "authrole": "<assigned auth role>", "authmethod": "wampcra", ... }