autobahn::wamp_transport Class Referenceabstract

Provides an abstraction for a transport to be used by the session. More...

#include <wamp_transport.hpp>

Inheritance diagram for autobahn::wamp_transport:
autobahn::wamp_rawsocket_transport< Socket > autobahn::wamp_websocket_transport autobahn::wamp_rawsocket_transport< boost::asio::ip::tcp::socket > autobahn::wamp_websocketpp_websocket_transport< Config > autobahn::wamp_tcp_transport

Public Types

using pause_handler = std::function< void()>
 Handler to invoke when pausing transport transmission.
 
using resume_handler = std::function< void()>
 Handler to invoke when resuming transport transmission.
 

Public Member Functions

virtual ~wamp_transport ()=default
 Default virtual destructor.
 
virtual boost::future< void > connect ()=0
 Attempts to connect the transport. More...
 
virtual boost::future< void > disconnect ()=0
 Attempts to disconnect the transport. More...
 
virtual bool is_connected () const =0
 Determines if the transport is connected. More...
 
virtual void send_message (wamp_message &&message)=0
 Send the message synchronously over the transport. More...
 
virtual void set_pause_handler (pause_handler &&handler)=0
 Set the handler to be invoked when the transport detects congestion sending to the remote peer and needs to apply backpressure on the application. More...
 
virtual void set_resume_handler (resume_handler &&handler)=0
 Set the handler to be invoked when the transport detects congestion has subsided on the remote peer and the application can resume sending messages. More...
 
virtual void pause ()=0
 Pause receiving of messages. More...
 
virtual void resume ()=0
 Resume receiving of messages. More...
 
virtual void attach (const std::shared_ptr< wamp_transport_handler > &handler)=0
 Attaches a handler to the transport. More...
 
virtual void detach ()=0
 Detaches the handler currently attached to the transport.
 
virtual bool has_handler () const =0
 Determines if the transport has a handler attached. More...
 

Detailed Description

Provides an abstraction for a transport to be used by the session.

A wamp transport is defined as being message based, bidirectional, reliable, and ordered.

Definition at line 49 of file wamp_transport.hpp.

Member Function Documentation

virtual void autobahn::wamp_transport::attach ( const std::shared_ptr< wamp_transport_handler > &  handler)
pure virtual

Attaches a handler to the transport.

Only one handler may be attached at any given time.

Parameters
handlerThe handler to attach to this transport.

Implemented in autobahn::wamp_rawsocket_transport< Socket >, autobahn::wamp_rawsocket_transport< boost::asio::ip::tcp::socket >, and autobahn::wamp_websocket_transport.

virtual boost::future<void> autobahn::wamp_transport::connect ( )
pure virtual

Attempts to connect the transport.

Returns
A future that will be satisfied when the connect attempt has been made.

Implemented in autobahn::wamp_rawsocket_transport< Socket >, autobahn::wamp_rawsocket_transport< boost::asio::ip::tcp::socket >, autobahn::wamp_websocket_transport, and autobahn::wamp_tcp_transport.

virtual boost::future<void> autobahn::wamp_transport::disconnect ( )
pure virtual

Attempts to disconnect the transport.

Returns
A future that will be satisfied when the disconnect attempt has been made.

Implemented in autobahn::wamp_rawsocket_transport< Socket >, autobahn::wamp_rawsocket_transport< boost::asio::ip::tcp::socket >, and autobahn::wamp_websocket_transport.

virtual bool autobahn::wamp_transport::has_handler ( ) const
pure virtual

Determines if the transport has a handler attached.

Returns
Whether or not a handler is attached.

Implemented in autobahn::wamp_rawsocket_transport< Socket >, autobahn::wamp_rawsocket_transport< boost::asio::ip::tcp::socket >, and autobahn::wamp_websocket_transport.

virtual bool autobahn::wamp_transport::is_connected ( ) const
pure virtual
virtual void autobahn::wamp_transport::pause ( )
pure virtual

Pause receiving of messages.

This will prevent the transport from receiving any more messages until it has been resumed. This is used to excert backpressure on the sending peer.

Implemented in autobahn::wamp_rawsocket_transport< Socket >, autobahn::wamp_rawsocket_transport< boost::asio::ip::tcp::socket >, and autobahn::wamp_websocket_transport.

virtual void autobahn::wamp_transport::resume ( )
pure virtual

Resume receiving of messages.

The transport will now begin receiving messsages again and lift backpressure from the sending peer.

Implemented in autobahn::wamp_rawsocket_transport< Socket >, autobahn::wamp_rawsocket_transport< boost::asio::ip::tcp::socket >, and autobahn::wamp_websocket_transport.

virtual void autobahn::wamp_transport::send_message ( wamp_message &&  message)
pure virtual

Send the message synchronously over the transport.

Parameters
messageThe message to be sent.

Implemented in autobahn::wamp_rawsocket_transport< Socket >, autobahn::wamp_rawsocket_transport< boost::asio::ip::tcp::socket >, and autobahn::wamp_websocket_transport.

virtual void autobahn::wamp_transport::set_pause_handler ( pause_handler &&  handler)
pure virtual

Set the handler to be invoked when the transport detects congestion sending to the remote peer and needs to apply backpressure on the application.

Parameters
handlerThe pause handler to be invoked.

Implemented in autobahn::wamp_rawsocket_transport< Socket >, autobahn::wamp_rawsocket_transport< boost::asio::ip::tcp::socket >, and autobahn::wamp_websocket_transport.

virtual void autobahn::wamp_transport::set_resume_handler ( resume_handler &&  handler)
pure virtual

Set the handler to be invoked when the transport detects congestion has subsided on the remote peer and the application can resume sending messages.

Parameters
handlerThe resume handler to be invoked.

Implemented in autobahn::wamp_rawsocket_transport< Socket >, autobahn::wamp_rawsocket_transport< boost::asio::ip::tcp::socket >, and autobahn::wamp_websocket_transport.