autobahn::wamp_websocket_transport Class Referenceabstract

A class that represents a base websocket transport. More...

#include <wamp_websocket_transport.hpp>

Inheritance diagram for autobahn::wamp_websocket_transport:
autobahn::wamp_transport autobahn::wamp_websocketpp_websocket_transport< Config >

Public Member Functions

 wamp_websocket_transport (const std::string &uri, bool debug_enabled=false)
 Constructs a websocket transport. More...
 
virtual boost::future< void > connect () override
 Attempts to connect the transport. More...
 
virtual boost::future< void > disconnect () override
 Attempts to disconnect the transport. More...
 
virtual bool is_connected () const override
 Determines if the transport is connected. More...
 
virtual void send_message (wamp_message &&message) override
 Send the message synchronously over the transport. More...
 
virtual void set_pause_handler (pause_handler &&handler) override
 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) override
 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 () override
 Pause receiving of messages. More...
 
virtual void resume () override
 Resume receiving of messages. More...
 
virtual void attach (const std::shared_ptr< wamp_transport_handler > &handler) override
 Attaches a handler to the transport. More...
 
virtual void detach () override
 Detaches the handler currently attached to the transport. More...
 
virtual bool has_handler () const override
 Determines if the transport has a handler attached. More...
 
- Public Member Functions inherited from autobahn::wamp_transport
virtual ~wamp_transport ()=default
 Default virtual destructor.
 

Protected Member Functions

virtual bool is_open () const =0
 
virtual void async_connect (const std::string &m_uri, boost::promise< void > &connect_promise)=0
 
virtual void close ()=0
 
virtual void write (void const *payload, size_t len)=0
 
void receive_message (const std::string &msg)
 

Protected Attributes

boost::promise< void > m_connect
 The promise that is fulfilled when the connect attempt is complete.
 
boost::promise< void > m_disconnect
 The promise that is fulfilled when the disconnect attempt is complete.
 

Additional Inherited Members

- Public Types inherited from autobahn::wamp_transport
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.
 

Detailed Description

A class that represents a base websocket transport.

Unlike raw socket base class, there is nothing to share about underlying websocket, It is completely up to derived class to handle specific websocket implementation

Definition at line 53 of file wamp_websocket_transport.hpp.

Constructor & Destructor Documentation

autobahn::wamp_websocket_transport::wamp_websocket_transport ( const std::string &  uri,
bool  debug_enabled = false 
)

Constructs a websocket transport.

Parameters
uriThe remote endpoint to connect to.

Member Function Documentation

virtual void autobahn::wamp_websocket_transport::attach ( const std::shared_ptr< wamp_transport_handler > &  handler)
overridevirtual

Attaches a handler to the transport.

Only one handler may be attached at any given time.

Parameters
handlerThe handler to attach to this transport.

Implements autobahn::wamp_transport.

virtual boost::future<void> autobahn::wamp_websocket_transport::connect ( )
overridevirtual

Attempts to connect the transport.

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

Implements autobahn::wamp_transport.

virtual void autobahn::wamp_websocket_transport::detach ( )
overridevirtual

Detaches the handler currently attached to the transport.

Implements autobahn::wamp_transport.

virtual boost::future<void> autobahn::wamp_websocket_transport::disconnect ( )
overridevirtual

Attempts to disconnect the transport.

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

Implements autobahn::wamp_transport.

virtual bool autobahn::wamp_websocket_transport::has_handler ( ) const
overridevirtual

Determines if the transport has a handler attached.

Returns
Whether or not a handler is attached.

Implements autobahn::wamp_transport.

virtual bool autobahn::wamp_websocket_transport::is_connected ( ) const
overridevirtual

Determines if the transport is connected.

Returns
Whether or not the transport is connected.

Implements autobahn::wamp_transport.

Reimplemented in autobahn::wamp_websocketpp_websocket_transport< Config >.

virtual void autobahn::wamp_websocket_transport::pause ( )
overridevirtual

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.

Implements autobahn::wamp_transport.

virtual void autobahn::wamp_websocket_transport::resume ( )
overridevirtual

Resume receiving of messages.

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

Implements autobahn::wamp_transport.

virtual void autobahn::wamp_websocket_transport::send_message ( wamp_message &&  message)
overridevirtual

Send the message synchronously over the transport.

Parameters
messageThe message to be sent.

Implements autobahn::wamp_transport.

virtual void autobahn::wamp_websocket_transport::set_pause_handler ( pause_handler &&  handler)
overridevirtual

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.

Implements autobahn::wamp_transport.

virtual void autobahn::wamp_websocket_transport::set_resume_handler ( resume_handler &&  handler)
overridevirtual

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.

Implements autobahn::wamp_transport.