34using websocketpp::lib::placeholders::_1;
35using websocketpp::lib::placeholders::_2;
36using websocketpp::lib::bind;
42 std::cout <<
"on_message called with hdl: " << hdl.lock().get()
43 <<
" and message: " << msg->get_payload()
48 if (msg->get_payload() ==
"stop-listening") {
54 s->send(hdl, msg->get_payload(), msg->get_opcode());
55 }
catch (websocketpp::lib::error_code
const & e) {
56 std::cout <<
"Echo failed because: " << e
57 <<
"(" << e.message() <<
")" << std::endl;
62 asio::io_service service;
74 ws_server.init_asio(&service);
78 ws_server.listen(9002);
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
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)
void on_message(ws_echo_server *s, websocketpp::connection_hdl hdl, ws_echo_server::message_ptr msg)
websocketpp::server< websocketpp::config::asio > ws_echo_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)