OSSIA
Open Scenario System for Interactive Application
Loading...
Searching...
No Matches
ossia::net::websocket_client_beast Class Referencefinal

Beast-based WebSocket client implementing websocket_client_interface. More...

Inheritance diagram for ossia::net::websocket_client_beast:
ossia::net::websocket_client_interface

Detailed Description

Beast-based WebSocket client implementing websocket_client_interface.

Public Member Functions

 websocket_client_beast (boost::asio::io_context &ctx)
 
 websocket_client_beast (boost::asio::io_context &ctx, ws_client_message_handler handler)
 Construct with a message handler callback.
 
 websocket_client_beast (ws_client_message_handler handler)
 
void connect (const std::string &uri) override
 Start an async connection to the given URI.
 
void connect_and_run (const std::string &uri) override
 Connect and block until the connection closes or fails.
 
void stop () override
 
bool connected () const override
 
void send_message (const std::string &request) override
 
void send_message (const rapidjson::StringBuffer &request) override
 
void send_binary_message (std::string_view request) override
 

Additional Inherited Members

- Public Attributes inherited from ossia::net::websocket_client_interface
Nano::Signal< void()> on_open
 
Nano::Signal< void()> on_close
 
Nano::Signal< void()> on_fail
 

Constructor & Destructor Documentation

◆ websocket_client_beast()

ossia::net::websocket_client_beast::websocket_client_beast ( ws_client_message_handler  handler)
explicit

Construct with own io_context and a message handler callback. The io_context is run internally by connect_and_run().

Member Function Documentation

◆ connect()

void ossia::net::websocket_client_beast::connect ( const std::string &  uri)
overridevirtual

Start an async connection to the given URI.

Implements ossia::net::websocket_client_interface.

◆ connect_and_run()

void ossia::net::websocket_client_beast::connect_and_run ( const std::string &  uri)
overridevirtual

Connect and block until the connection closes or fails.

Implements ossia::net::websocket_client_interface.

◆ stop()

void ossia::net::websocket_client_beast::stop ( )
overridevirtual

◆ connected()

bool ossia::net::websocket_client_beast::connected ( ) const
overridevirtual

◆ send_message() [1/2]

void ossia::net::websocket_client_beast::send_message ( const std::string &  request)
overridevirtual

◆ send_message() [2/2]

void ossia::net::websocket_client_beast::send_message ( const rapidjson::StringBuffer &  request)
overridevirtual

◆ send_binary_message()

void ossia::net::websocket_client_beast::send_binary_message ( std::string_view  request)
overridevirtual