OSSIA
Open Scenario System for Interactive Application
ossia::net::websocket_server Class Reference

Low-level websocket & http server for oscquery. More...

Inherited by ossia::net::websocket_simple_server.

Detailed Description

Low-level websocket & http server for oscquery.

Public Types

using config = websocketpp::config::asio
 
using transport_type = websocketpp::config::asio::transport_type
 
using server_t = websocketpp::server< websocketpp::config::asio >
 
using type = server_t
 
using connection_handler = websocketpp::connection_hdl
 
typedef config::concurrency_type concurrency_type
 
typedef websocketpp::connection< config > connection_type
 
typedef connection_type::ptr connection_ptr
 
typedef transport_type::transport_con_type transport_con_type
 
typedef transport_con_type::ptr transport_con_ptr
 
typedef websocketpp::endpoint< connection_type, config > endpoint_type
 

Public Member Functions

 websocket_server (ossia::net::network_context_ptr ctx)
 
template<typename Handler >
void set_open_handler (Handler h)
 
template<typename Handler >
void set_close_handler (Handler h)
 
template<typename Handler >
void set_message_handler (Handler h)
 
void listen (uint16_t port=9002)
 
void start_accept (boost::system::error_code &ec)
 
void run ()
 
void stop ()
 
void close (connection_handler hdl)
 
void send_message (connection_handler hdl, const std::string &message)
 
void send_message (connection_handler hdl, const ossia::net::server_reply &message)
 
void send_message (connection_handler hdl, const rapidjson::StringBuffer &message)
 
void send_binary_message (connection_handler hdl, const std::string &message)
 
void send_binary_message (connection_handler hdl, std::string_view message)
 
server_t & impl ()
 

Static Public Member Functions

static void init_handler (websocketpp::connection_hdl, boost::asio::ip::tcp::socket &s)
 

Protected Attributes

std::shared_ptr< server_t > m_server
 
ossia::net::network_context_ptr m_context
 
bool m_owns_context {}
 

Member Function Documentation

◆ start_accept()

void ossia::net::websocket_server::start_accept ( boost::system::error_code &  ec)
inline

ec = boost::asio::error::make_error_code(boost::asio::error::con_creation_failed);