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.
Questions tagged [boost-beast]
275 questions
3
votes
1 answer
boost::beast ssl tcp stream: gracefully disconnect and then reconnect
I have a boost::beast ssl stream data member:
class HttpsClient
{
...
asio::ssl::context _ssl_ctx;
beast::ssl_stream _stream;
};
At construction I initialise the stream with an asio::io_context and an ssl context as…

Steve Lorimer
- 27,059
- 17
- 118
- 213
3
votes
1 answer
Understand the usage of strand without locking
Reference:
websocket_client_async_ssl.cpp
strands
Question 1> Here is my understanding:
Given a few async operations bound with the same strand, the strand
will guarantee that all associated async operations will be executed
as a strictly…

q0987
- 34,938
- 69
- 242
- 387
3
votes
1 answer
boost async ws server checking client information
How do i check client information as user-agent from boost async web socket server ?
I have checked:
https://www.boost.org/doc/libs/develop/libs/beast/example/websocket/server/async/websocket_server_async.cpp
It was my only referance.

SASA
- 41
- 4
3
votes
1 answer
Crash when HTTP content length is very large
I have a boost-beast async http client which crashes when the content length is very large. I have tested it with a ncat http server as
cat response.txt| sudo ncat -lvnp 443 --ssl
where response.txt contains my response. Curiously the code doesnt…

Suman
- 31
- 1
3
votes
1 answer
How do I make this HTTPS connection persistent in Beast?
I'm making about 30,000 queries to a GraphQL server; because I have a high-latency connection, I'm doing many queries in parallel, using threads. Currently each query makes a new connection; I'd like to reuse the connections, which should reduce the…

Pierre Abbat
- 485
- 4
- 10
3
votes
1 answer
What do I need to do to make Boost.Beast HTTP parser find the end of the body?
I am trying to parse HTTPS response using boost::beast::http::parser.
My parser is defined like this:
boost::beast::http::parser response_parser;
And the callback for async read is like this:
void…

alexozornin
- 33
- 1
- 4
3
votes
1 answer
gmock SetArgReferee: Set a non-copyable non-moveable object
I'm using gmock and have mocked a function that takes
boost::beast::http::response_parser as an out parameter. Function
signature looks something like:
error_code readFromSocket(boost::beast::http::response_parser& resp);
Now, to test this…

Abhishek Arya
- 450
- 4
- 16
3
votes
1 answer
io_context.run() in a separate thread blocks
I have a RESTServer.hpp implemented using boost.beast as shown below.
#pragma once
#include
#include
#include
#include
#include…

liv2hak
- 14,472
- 53
- 157
- 270
3
votes
0 answers
Unit Testing a http rest client implemented using boost::beast
I have an HTTP REST client implemented using boost::beast.
RESTClient.hpp
#pragma once
#include
#include
#include
#include
#include…

liv2hak
- 14,472
- 53
- 157
- 270
3
votes
1 answer
Boost asio io_content run non-blocking
Currently i am writing a C++ Websocket Client Library which get wrapped in a C# Library.
I am using Boost Beast for the websocket connection.
Now i am at the point that i start a async_read when the handshake is completed so the websocket dont…

L1nk27
- 65
- 2
- 7
3
votes
1 answer
boost beast websocket server read with error code End of file and Operation cancelled
I am trying to setup a websocket server as described in this boost beast example.
Everything works fine except that the websocket stream read throw unexpeced system error with error code of "End of file" and "Operation cancelled"
beast::flat_buffer…

FaceBro
- 787
- 2
- 13
- 29
3
votes
1 answer
Boost::Beast : server with websocket pipelining
I am writing a c++ websocket server with boost beast 1.70 and mysql 8 C connector. The server will have several clients simultaneously connected. The particularity is that each client will perform like 100 websocket requests in a row to the server.…

Julien
- 51
- 7
3
votes
1 answer
Is it possible to handle a blocking read function with timeout?
I am working on boost websockets for asynchronous communication between the client and server.
Now I am printing the time elapsed during the program with boost::timer::auto_cpu_timer. It is displaying the time elapsed in seconds.
My program snippet…

RC0993
- 898
- 1
- 13
- 44
3
votes
0 answers
Boost Beast async HTTP client + std::future
I have a project that will do some networking and would like to wrap underlying Boost Beast HTTP(S) requests implementation inside futures.
I copied the session class from…

Xeverous
- 973
- 1
- 12
- 25
3
votes
3 answers
Using Boost::Beast for CPU-heavy REST APIs, Should I use Async or Sync way to implement them to expect the better latency?
I'm trying to use boost::beast to implement a web service providing some REST APIs. These APIs are CPU-heavy, almost no disk or db I/O. My goal is to optimize for latency with OK throughput. Should I use sync or async way to implement them?
Thanks!

NonStatic
- 951
- 1
- 8
- 27