Код: Выделить всё
std::future Websocket::async_connect() {
io_thread_ = std::thread([this]() {
ioc_.run();
});
// Start resolve
auto resolve_fut = resolver_.async_resolve(host_, port_, net::use_future);
return std::async(std::launch::async, [this, resolve_fut = std::move(resolve_fut)]() mutable {
try {
auto results = resolve_fut.get();
auto connect_fut = beast::get_lowest_layer(ws_).async_connect(*results, net::use_future);
connect_fut.get();
auto ssl_handshake_fut = ws_.next_layer().async_handshake(ssl::stream_base::client, net::use_future);
ssl_handshake_fut.get();
ws_.set_option(websocket::stream_base::timeout::suggested(beast::role_type::client));
auto ws_handshake_fut = ws_.async_handshake(host_, target_, net::use_future);
ws_handshake_fut.get();
webSocketLogger_.info("Connected to WebSocket Successfully!!!");
// std::cout
Подробнее здесь: [url]https://stackoverflow.com/questions/79816755/boost-beast-async-connect-fails-after-upgrading-boost-1-78-to-1-89[/url]
Мобильная версия