28 #ifndef WEBSOCKETPP_ENDPOINT_IMPL_HPP
29 #define WEBSOCKETPP_ENDPOINT_IMPL_HPP
35 template <
typename connection,
typename config>
36 typename endpoint<connection,config>::connection_ptr
37 endpoint<connection,config>::create_connection() {
38 m_alog->write(log::alevel::devel,
"create_connection");
47 connection_ptr con = lib::make_shared<connection_type>(m_is_server,
48 m_user_agent, m_alog, m_elog, lib::ref(m_rng));
50 connection_weak_ptr w(con);
59 con->set_open_handler(m_open_handler);
60 con->set_close_handler(m_close_handler);
61 con->set_fail_handler(m_fail_handler);
62 con->set_ping_handler(m_ping_handler);
63 con->set_pong_handler(m_pong_handler);
64 con->set_pong_timeout_handler(m_pong_timeout_handler);
65 con->set_interrupt_handler(m_interrupt_handler);
66 con->set_http_handler(m_http_handler);
67 con->set_validate_handler(m_validate_handler);
68 con->set_message_handler(m_message_handler);
70 if (m_open_handshake_timeout_dur != config::timeout_open_handshake) {
71 con->set_open_handshake_timeout(m_open_handshake_timeout_dur);
73 if (m_close_handshake_timeout_dur != config::timeout_close_handshake) {
74 con->set_close_handshake_timeout(m_close_handshake_timeout_dur);
76 if (m_pong_timeout_dur != config::timeout_pong) {
77 con->set_pong_timeout(m_pong_timeout_dur);
79 if (m_max_message_size != config::max_message_size) {
80 con->set_max_message_size(m_max_message_size);
82 con->set_max_http_body_size(m_max_http_body_size);
86 ec = transport_type::init(con);
88 m_elog->write(log::elevel::fatal,ec.message());
89 return connection_ptr();