void endpoint<connection,config>::pong(connection_hdl hdl, std::string const & payload, lib::error_code & ec) { connection_ptr con = get_con_from_hdl(hdl,ec); if (ec) {return;} con->pong(payload,ec); }
void endpoint<connection,config>::send(connection_hdl hdl, message_ptr msg, lib::error_code & ec) { connection_ptr con = get_con_from_hdl(hdl,ec); if (ec) {return;} ec = con->send(msg); }
void endpoint<connection,config>::send(connection_hdl hdl, void const * payload, size_t len, frame::opcode::value op, lib::error_code & ec) { connection_ptr con = get_con_from_hdl(hdl,ec); if (ec) {return;} ec = con->send(payload,len,op); }
void endpoint<connection,config>::send_http_response(connection_hdl hdl, lib::error_code & ec) { connection_ptr con = get_con_from_hdl(hdl,ec); if (ec) {return;} con->send_http_response(ec); }
void endpoint<connection,config>::resume_reading(connection_hdl hdl, lib::error_code & ec) { connection_ptr con = get_con_from_hdl(hdl,ec); if (ec) {return;} ec = con->resume_reading(); }
void endpoint<connection,config>::send(connection_hdl hdl, std::string const & payload, frame::opcode::value op, lib::error_code & ec) { connection_ptr con = get_con_from_hdl(hdl,ec); if (ec) {return;} ec = con->send(payload,op); }
void endpoint<connection,config>::close(connection_hdl hdl, close::status::value const code, std::string const & reason, lib::error_code & ec) { connection_ptr con = get_con_from_hdl(hdl,ec); if (ec) {return;} con->close(code,reason,ec); }
void endpoint<connection,config>::interrupt(connection_hdl hdl, lib::error_code & ec) { connection_ptr con = get_con_from_hdl(hdl,ec); if (ec) {return;} m_alog.write(log::alevel::devel,"Interrupting connection"); ec = con->interrupt(); }
EndpointPtr04 WebSocket04::makeEndpoint (HandlerPtr&& handler) { auto endpoint = std::make_shared <Endpoint> (std::move (handler)); endpoint->set_open_handler ( [endpoint] (websocketpp::connection_hdl hdl) { if (auto conn = endpoint->get_con_from_hdl(hdl)) endpoint->handler()->on_open (conn); }); endpoint->set_close_handler ( [endpoint] (websocketpp::connection_hdl hdl) { if (auto conn = endpoint->get_con_from_hdl(hdl)) endpoint->handler()->on_close (conn); }); endpoint->set_fail_handler ( [endpoint] (websocketpp::connection_hdl hdl) { if (auto conn = endpoint->get_con_from_hdl(hdl)) endpoint->handler()->on_fail (conn); }); endpoint->set_pong_handler ( [endpoint] (websocketpp::connection_hdl hdl, std::string data) { if (auto conn = endpoint->get_con_from_hdl(hdl)) endpoint->handler()->on_pong (conn, data); }); endpoint->set_http_handler ( [endpoint] (websocketpp::connection_hdl hdl) { if (auto conn = endpoint->get_con_from_hdl(hdl)) endpoint->handler()->http (conn); }); endpoint->set_message_handler ( [endpoint] (websocketpp::connection_hdl hdl, MessagePtr msg) { if (auto conn = endpoint->get_con_from_hdl(hdl)) endpoint->handler()->on_message (conn, msg); }); endpoint->set_send_empty_handler ( [endpoint] (websocketpp::connection_hdl hdl) { if (auto conn = endpoint->get_con_from_hdl(hdl)) endpoint->handler()->on_send_empty (conn); }); endpoint->init_asio(); return endpoint; }