Questions tagged [boost-beast]

Beast is a C++ header-only library serving as a foundation for writing interoperable networking libraries by providing low-level HTTP/1, WebSocket, and networking protocol vocabulary types and algorithms using the consistent asynchronous model of Boost.Asio.

275 questions
2
votes
1 answer

Should I clean up beast::flat_buffer when I see errors on on_read?

http_client_async_ssl class session : public std::enable_shared_from_this { ... beast::flat_buffer buffer_; // (Must persist between reads) http::response res_; ... } void on_write(beast::error_code ec,…
q0987
  • 34,938
  • 69
  • 242
  • 387
2
votes
1 answer

handshake: The WebSocket handshake was declined by the remote peer

Code Snippet : #include #include #include #include #include #include #include…
dopller
  • 291
  • 3
  • 13
2
votes
1 answer

Boost Beast Async Websocket Server How to interface with session?

So I don't know why but I can't wrap my head around the boost Beast websocket server and how you can (or should) interact with it. The basic program I made looks like this, across 2 classes (WebSocketListener and…
user1024792
  • 553
  • 1
  • 10
  • 23
2
votes
2 answers

How to convert http::response::base() to std::string?

Reference: base basic_fields base() : Returns the header portion of the message. http::response res_; std::cout << "Type of res_.base() : " << typeid(res_.base()).name() << std::endl; // Type of res_.base() :…
q0987
  • 34,938
  • 69
  • 242
  • 387
2
votes
1 answer

Understand the usage of timeout in beast::tcp_stream?

Reference: https://www.boost.org/doc/libs/1_78_0/libs/beast/example/websocket/client/async/websocket_client_async.cpp https://www.boost.org/doc/libs/1_78_0/libs/beast/doc/html/beast/using_io/timeouts.html https://www.boost.org/doc/libs/1_78_0/libs/be…
q0987
  • 34,938
  • 69
  • 242
  • 387
2
votes
1 answer

Does mulithreaded http processing with boost asio require strands?

In the boost asio documentation for strands it says: Strands may be either implicit or explicit, as illustrated by the following alternative approaches: ... Where there is a single chain of asynchronous operations associated with a connection…
Reizo
  • 1,374
  • 12
  • 17
2
votes
1 answer

How to use custom allocator when using boost::asio/beast with C++20 coroutines

I'm trying to find a way to hook a custom allocator when using boost::beast with asio::use_awaitable and C++ 20 coroutines. Given this function sketch: asio::awaitable process_request(asio::ip::tcp::socket sock) { …
Pavel Vazharov
  • 115
  • 1
  • 4
2
votes
0 answers

Boost beast read: The WebSocket control frame was fragmented

While I am trying the code from: advanced_server example I am getting following error here: read: The WebSocket control frame was fragmented The client is sending ping control message using Poco framework. The payload is of zero bytes length. What…
monotosh
  • 21
  • 1
2
votes
0 answers

Using boost::beast::websocket to send http post request

I've got the following class member boost::beast::websocket::stream ws_; which gets instantiated on class c'tor using boost::asio::io_service as parameter. I assume that all the websocket protocol is implemented on top of…
Zohar81
  • 4,554
  • 5
  • 29
  • 82
2
votes
1 answer

Why is `net::dispatch` needed when the I/O object already has an executor?

I'm learning Boost.Beast & Boost.Asio from this example libs/beast/example/http/server/async-ssl/http_server_async_ssl.cpp - 1.77.0. As far as I know, all I/O operations that happen on a I/O object happen in the I/O execution context of the object.…
Cody
  • 609
  • 4
  • 21
2
votes
2 answers

How to construct a boost::beast::http::message from std::string?

Is that possible to construct a boost::beast::http::message (specifically I have to construct a boost::beast::http::response) from std::string, std::string_view or other raw buffer? Maybe there is some kind of parser? From what…
Andrey K.
  • 35
  • 1
  • 7
2
votes
1 answer

Strange http response via boost

Catching error message http_error_category::bad_reason as a result of http request via boost. What approximately does this error mean?
born4bits
  • 21
  • 3
2
votes
2 answers

boost asio certificate verification

I'm writing code for an embedded linux system, I have some code based on boost beast websockets and it's able to successfully connect to a couple of different TLS encrypted websites. However I've discovered another one, where it's not working, but…
Alex
  • 669
  • 15
  • 37
2
votes
1 answer

Is there any way to subscribe and to listen feed in boost beast websocket?

I am using an example from boost beast documentation for async websocket client. The to send some command to subscribe and then to listen feed until it is terminated manually (preferably with other function or else) Standard examples aren't applied…
2
votes
1 answer

CMake multiple errors when include boost/beast/http.hpp

I'm trying to build my project that uses boost beast library with cmake. When I use only boost asio library everything builds okay. But when I add boost/beast/http.hpp header when cmake gives a huge amount of errors. CMake…
imil4eg
  • 77
  • 7