2

我已经构建了一个通过 boost::beast 连接到 bitmex 的应用程序。使用以下提供的代码,同步调用可以正常工作:

https://www.boost.org/doc/libs/develop/libs/beast/example/websocket/client/sync-ssl/websocket_client_sync_ssl.cpp

但是,在以下位置异步执行相同操作的代码: https ://www.boost.org/doc/libs/master/libs/beast/example/websocket/client/async-ssl/websocket_client_async_ssl.cpp

在执行 websocket 握手时总是会中断(核心):

on_ssl_handshake(boost::system::error_code ec)
{
    if(ec)
       return ;//fail(ec, "ssl_handshake");

    // Perform the websocket handshake
    **ws_.async_handshake(host_, "/realtime",
        std::bind(
            &session::on_handshake,
            shared_from_this(),
            std::placeholders::_1));**
}

/realtime 是数据应该来自服务器端的目标。

4

0 回答 0