9using websocketpp::lib::placeholders::_1;
10using websocketpp::lib::placeholders::_2;
11using websocketpp::lib::bind;
18 std::cout <<
"on_message called with hdl: " << hdl.lock().get()
19 <<
" and message: " << msg->get_payload()
24 if (msg->get_payload() ==
"stop-listening") {
30 s->send(hdl, msg->get_payload(), msg->get_opcode());
31 }
catch (
const websocketpp::lib::error_code& e) {
32 std::cout <<
"Echo failed because: " << e
33 <<
"(" << e.message() <<
")" << std::endl;
47 echo_server.init_asio();
53 echo_server.listen(9002);
61 std::cout << e.
what() << std::endl;
63 std::cout <<
"other exception" << std::endl;
void set_message_handler(message_handler h)
void clear_access_channels(log::level channels)
Clear Access logging channels.
void set_access_channels(log::level channels)
Set Access logging channel.
connection_type::message_ptr message_ptr
virtual char const * what() const
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)
websocketpp::config::asio_tls_client::message_type::ptr message_ptr
void on_message(server *s, websocketpp::connection_hdl hdl, message_ptr msg)
websocketpp::server< websocketpp::config::asio > server
lib::weak_ptr< void > connection_hdl
A handle to uniquely identify a connection.
static level const all
Special aggregate value representing "all levels".
static level const frame_payload
One line per frame, includes the full message payload (warning: chatty)