Код: Выделить всё
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
typedef websocketpp::client client;
class connection_metadata {
private:
int m_id;
websocketpp::connection_hdl m_hdl;
std::string m_status;
std::string m_uri;
std::string m_server;
std::string m_error_reason;
public:
typedef websocketpp::lib::shared_ptr ptr;
connection_metadata(int id, websocketpp::connection_hdl hdl, std::string uri):
m_id(id),
m_hdl(hdl),
m_status("Connecting"),
m_uri(uri),
m_server("N/A")
{}
int get_id(){return m_id;}
websocketpp::connection_hdl get_hdl(){ return m_hdl;}
std::string get_status(){return m_status;}
void on_open(client * c, websocketpp::connection_hdl hdl){
m_status = "Open";
client::connection_ptr con = c->get_con_from_hdl(hdl);
m_server = con->get_response_header("Server");
}
void on_fail(client * c, websocketpp::connection_hdl hdl){
m_status = "Failed";
client::connection_ptr con = c->get_con_from_hdl(hdl);
m_server = con->get_response_header("Server");
m_error_reason = con->get_ec().message();
}
void on_close(client * c, websocketpp::connection_hdl hdl){
m_status = "Closed";
client::connection_ptr con = c->get_con_from_hdl(hdl);
std::stringstream s;
s
Подробнее здесь: [url]https://stackoverflow.com/questions/79131065/tls-init-handler-not-getting-set-for-websocket[/url]