Stream truncated (Boost.Beast / Boost.Asio)

  boost, boost-asio, boost-beast, c++, websocket


I’m trying to write a C++ websocket with Boost.Beast. Websocket is needed for interacting with API (code samples in different languages – But at line ";" I get an error "stream truncated".

How to reproduce:

  1. Program code – Boost.Beast example of WebSocket SSL client, synchronous – .

  2. Root certificates.hpp – needed for program code, you can take it from here – .

  3. Don’t forget to change the top line in program code, this line is #include "example/common/root_certificates.hpp. If you placed your root_certificates.hpp from step 2 to another place, make sure your code can #include it.

  4. In program code from step 1 place this code:

    argc = 4;

     argv[0] = "websocket-client-sync";
     argv[1] = "";
     argv[2] = "443";
     argv[3] = "{"ticks":"R_100"}";
     auto target = "/websockets/v3?app_id=1089";



  1. In program code from step 1 replace ws.handshake(host, "/"); on ws.handshake(host, target);

What I’m trying to get as result:

You can see if you go with this link – , in "Location:" type wss:// and in "Message:" type {"ticks":"R_100"} . And then click "Connect" and "Send".

Source: Windows Questions C++

One Reply to “Stream truncated (Boost.Beast / Boost.Asio)”