78using websocketpp::lib::placeholders::_1;
79using websocketpp::lib::placeholders::_2;
80using websocketpp::lib::bind;
87 s->send(hdl, msg->get_payload(), msg->get_opcode());
91 boost::asio::ip::tcp::no_delay
option(
true);
100 size_t num_threads = 1;
103 port = atoi(
argv[1]);
104 num_threads = atoi(
argv[2]);
113 testee_server.init_asio();
114 testee_server.set_reuse_addr(
true);
118 testee_server.set_socket_init_handler(bind(&
on_socket_init,::_1,::_2));
121 testee_server.set_listen_backlog(8192);
122 testee_server.listen(port);
128 if (num_threads == 1) {
131 typedef websocketpp::lib::shared_ptr<websocketpp::lib::thread> thread_ptr;
132 std::vector<thread_ptr> ts;
133 for (
size_t i = 0; i < num_threads; i++) {
134 ts.push_back(websocketpp::lib::make_shared<websocketpp::lib::thread>(&server::run, &testee_server));
137 for (
size_t i = 0; i < num_threads; i++) {
143 std::cout <<
"exception: " << e.
what() << std::endl;
Concurrency policy that uses std::mutex / boost::mutex.
Stub for user supplied base class.
void set_message_handler(message_handler h)
void clear_access_channels(log::level channels)
Clear Access logging channels.
connection_type::message_ptr message_ptr
void clear_error_channels(log::level channels)
Clear Error logging channels.
virtual char const * what() const
Stores, parses, and manipulates HTTP requests.
Stores, parses, and manipulates HTTP responses.
Basic logger that outputs to an ostream.
Represents a buffer for a single WebSocket message.
Thread safe stub "random" integer generator.
Server endpoint role based on the given config.
void start_accept(lib::error_code &ec)
Starts the server's async connection acceptance loop (exception free)
Asio based endpoint transport component.
websocketpp::config::asio_tls_client::message_type::ptr message_ptr
uint32_t level
Type of a channel package.
lib::weak_ptr< void > connection_hdl
A handle to uniquely identify a connection.
permessage_compress extension
static bool const enable_multithreading
core::response_type response_type
core::elog_type elog_type
core::concurrency_type concurrency_type
core::request_type request_type
core::alog_type alog_type
core::concurrency_type concurrency_type
core::message_type message_type
core::elog_type elog_type
static bool const enable_multithreading
websocketpp::extensions::permessage_deflate::enabled< permessage_deflate_config > permessage_deflate_type
core::con_msg_manager_type con_msg_manager_type
core::response_type response_type
core::alog_type alog_type
core::endpoint_msg_manager_type endpoint_msg_manager_type
websocketpp::transport::asio::endpoint< transport_config > transport_type
websocketpp::config::asio core
core::request_type request_type
static const websocketpp::log::level elog_level
core::endpoint_base endpoint_base
static const websocketpp::log::level alog_level
Server config with asio transport and TLS disabled.
static level const none
Special aggregate value representing "no levels".
static level const all
Special aggregate value representing "all levels".
static level const none
Special aggregate value representing "no levels".
websocketpp::server< testee_config > server
void on_socket_init(websocketpp::connection_hdl, boost::asio::ip::tcp::socket &s)
void on_message(server *s, websocketpp::connection_hdl hdl, message_ptr msg)