2

I've built an app that connects to bitmex through boost::beast. The synchronous call works fine using the code provided at:

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

however the code that does the same thing asynchronously at: https://www.boost.org/doc/libs/master/libs/beast/example/websocket/client/async-ssl/websocket_client_async_ssl.cpp

always breaks (cores) exactly when the websocket handshake is performed:

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));**
}

The /realtime is the target that the data should be coming from on the server side.

sehe
  • 374,641
  • 47
  • 450
  • 633
  • Needs more information. Can you check the versions that you built against vs those found at runtime. Run with asan/ubsan or valgrind etc. Also, you don't show the actual code. – sehe Jul 09 '18 at 22:43
  • Where's the strand? – Vinnie Falco Jul 10 '18 at 03:28
  • my understanding is the strand is used only if multiple threadfs are making the asynchroneous calls, which is not the case. I need to clarify that the crash happens only because of our delayed logging, not when the handshake is performed. The bottom line is I am not sure how to receive callbacks from the server and process then accordingly. Should I expect the data to show up in the on_write method? It seems that one the io.run the example code wants to close the socket. I take it if I don't close it the updates will call the on_write callback – user10055921 Jul 11 '18 at 15:00
  • no strand in my code – user10055921 Jul 11 '18 at 18:11
  • code built with boost_1_67 – user10055921 Jul 11 '18 at 18:12
  • Was this resolved? – Vinnie Falco Aug 01 '19 at 22:28

0 Answers0