28#ifndef WEBSOCKETPP_ENDPOINT_IMPL_HPP
29#define WEBSOCKETPP_ENDPOINT_IMPL_HPP
35template <
typename connection,
typename config>
47 connection_ptr con = lib::make_shared<connection_type>(m_is_server,
48 m_user_agent, lib::ref(m_alog), lib::ref(m_elog), lib::ref(m_rng));
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);
95template <
typename connection,
typename config>
103 ec = con->interrupt();
106template <
typename connection,
typename config>
113template <
typename connection,
typename config>
119 ec = con->pause_reading();
122template <
typename connection,
typename config>
125 pause_reading(hdl,ec);
129template <
typename connection,
typename config>
135 ec = con->resume_reading();
138template <
typename connection,
typename config>
141 resume_reading(hdl,ec);
145template <
typename connection,
typename config>
147 lib::error_code & ec)
151 con->send_http_response(ec);
154template <
typename connection,
typename config>
157 send_http_response(hdl,ec);
161template <
typename connection,
typename config>
168 ec = con->send(payload,
op);
171template <
typename connection,
typename config>
176 send(hdl,payload,
op,ec);
180template <
typename connection,
typename config>
186 ec = con->send(payload,
len,
op);
189template <
typename connection,
typename config>
194 send(hdl,payload,
len,
op,ec);
198template <
typename connection,
typename config>
200 lib::error_code & ec)
207template <
typename connection,
typename config>
214template <
typename connection,
typename config>
216 const code, std::string
const & reason,
217 lib::error_code & ec)
221 con->close(code,reason,ec);
224template <
typename connection,
typename config>
226 const code, std::string
const & reason)
229 close(hdl,code,reason,ec);
233template <
typename connection,
typename config>
235 payload, lib::error_code & ec)
239 con->ping(payload,ec);
242template <
typename connection,
typename config>
246 ping(hdl,payload,ec);
250template <
typename connection,
typename config>
252 lib::error_code & ec)
256 con->pong(payload,ec);
259template <
typename connection,
typename config>
263 pong(hdl,payload,ec);
void ping(connection_hdl hdl, std::string const &payload, lib::error_code &ec)
Send a ping to a specific connection.
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)
void pong(connection_hdl hdl, std::string const &payload, lib::error_code &ec)
Send a pong to a specific connection.
connection_type::weak_ptr connection_weak_ptr
Weak pointer to connection type.
connection_type::message_ptr message_ptr
Type of message pointers that this endpoint uses.
void resume_reading(connection_hdl hdl, lib::error_code &ec)
Resume reading of new data (exception free)
void close(connection_hdl hdl, close::status::value const code, std::string const &reason, lib::error_code &ec)
connection_type::ptr connection_ptr
Shared pointer to connection_type.
void interrupt(connection_hdl hdl, lib::error_code &ec)
connection_ptr create_connection()
void send_http_response(connection_hdl hdl, lib::error_code &ec)
Send deferred HTTP Response.
void pause_reading(connection_hdl hdl, lib::error_code &ec)
Pause reading of new data (exception free)
client::connection_ptr connection_ptr
uint16_t value
The type of a close code value.
Namespace for the WebSocket++ project.
lib::weak_ptr< void > connection_hdl
A handle to uniquely identify a connection.
static level const devel
Development messages (warning: very chatty)