9 using websocketpp::lib::placeholders::_1;
10 using websocketpp::lib::placeholders::_2;
11 using 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;
61 std::cout << e.
what() << std::endl;
63 std::cout <<
"other exception" << std::endl;
static level const all
Special aggregate value representing "all levels".
websocketpp::config::asio_tls_client::message_type::ptr message_ptr
void on_message(server *s, websocketpp::connection_hdl hdl, message_ptr msg)
server::message_ptr message_ptr
connection_type::message_ptr message_ptr
Type of message pointers that this endpoint uses.
static level const frame_payload
One line per frame, includes the full message payload (warning: chatty)
lib::weak_ptr< void > connection_hdl
A handle to uniquely identify a connection.
void init_asio(io_service_ptr ptr, lib::error_code &ec)
initialize asio transport with external io_service (exception free)
virtual char const * what() const
void start_accept(lib::error_code &ec)
Starts the server's async connection acceptance loop (exception free)
void set_access_channels(log::level channels)
Set Access logging channel.
void stop_listening(lib::error_code &ec)
Stop listening (exception free)
websocketpp::server< websocketpp::config::asio > server
void clear_access_channels(log::level channels)
Clear Access logging channels.
std::size_t run()
wraps the run method of the internal io_service object
void listen(lib::asio::ip::tcp::endpoint const &ep, lib::error_code &ec)
Set up endpoint for listening manually (exception free)
void set_message_handler(message_handler h)
void send(connection_hdl hdl, std::string const &payload, frame::opcode::value op, lib::error_code &ec)
Create a message and add it to the outgoing send queue (exception free)