89 using websocketpp::lib::placeholders::_1;
90 using websocketpp::lib::placeholders::_2;
91 using websocketpp::lib::bind;
104 std::string res = con->get_request_body();
106 std::stringstream ss;
107 ss <<
"got HTTP request with " << res.size() <<
" bytes of body data.";
109 con->set_body(ss.str());
116 std::cout <<
"Fail handler: " << con->get_ec() <<
" " << con->get_ec().message() << std::endl;
120 std::cout <<
"Close handler" << std::endl;
125 std::cout <<
"on_message called with hdl: " << hdl.lock().get()
126 <<
" and message: " << msg->get_payload()
130 s->
send(hdl, msg->get_payload(), msg->get_opcode());
132 std::cout <<
"Echo failed because: " 133 <<
"(" << e.
what() <<
")" << std::endl;
168 std::cout << e.
what() << std::endl;
169 }
catch (
const std::exception & e) {
170 std::cout << e.what() << std::endl;
172 std::cout <<
"other exception" << std::endl;
static level const all
Special aggregate value representing "all levels".
Asio based endpoint transport component.
websocketpp::config::asio_tls_client::message_type::ptr message_ptr
type::request_type request_type
type::alog_type alog_type
websocketpp::transport::asio::basic_socket::endpoint socket_type
void set_reuse_addr(bool value)
Sets whether to use the SO_REUSEADDR flag when opening listening sockets.
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)
stub_config::con_msg_manager_type con_msg_manager_type
lib::weak_ptr< void > connection_hdl
A handle to uniquely identify a connection.
websocketpp::transport::asio::endpoint< transport_config > transport_type
connection_ptr get_con_from_hdl(connection_hdl hdl, lib::error_code &ec)
Retrieves a connection_ptr from a connection_hdl (exception free)
void set_close_handler(close_handler h)
base::alog_type alog_type
Custom Logging policies.
base::endpoint_msg_manager_type endpoint_msg_manager_type
type::response_type response_type
void init_asio(io_service_ptr ptr, lib::error_code &ec)
initialize asio transport with external io_service (exception free)
base::request_type request_type
void on_fail(server *s, websocketpp::connection_hdl hdl)
base::response_type response_type
base::elog_type elog_type
void start_accept(lib::error_code &ec)
Starts the server's async connection acceptance loop (exception free)
Server endpoint role based on the given config.
void set_access_channels(log::level channels)
Set Access logging channel.
server::message_ptr message_ptr
void set_http_handler(http_handler h)
base::con_msg_manager_type con_msg_manager_type
bool validate(server *, websocketpp::connection_hdl)
void set_validate_handler(validate_handler h)
Basic ASIO endpoint socket component.
void set_fail_handler(fail_handler h)
static const long timeout_open_handshake
websocketpp::server< debug_custom > server
type::concurrency_type concurrency_type
void clear_access_channels(log::level channels)
Clear Access logging channels.
void on_http(server *s, websocketpp::connection_hdl hdl)
type::elog_type elog_type
====== WARNING ======== This example is presently used as a scratch space.
Client/Server debug config with asio transport and TLS disabled.
connection_type::ptr connection_ptr
Type of a shared pointer to the connections this server will create.
base::concurrency_type concurrency_type
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 on_message(server *s, websocketpp::connection_hdl hdl, message_ptr msg)
void set_message_handler(message_handler h)
void on_close(websocketpp::connection_hdl)
virtual char const * what() const
base::message_type message_type
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)