News

News

RSS feed
01/02/2023
Asio 201 - timeouts, cancellation & custom tokens

Since asio added and beast implemented per-operation cancellation, the way timeouts can be implemented in asio code has changed significantly. In this article, we’ll go from simple timeouts to building our own timeout completion token helper. Cancellation A timeout is a defined interval after which a cancellation will be triggered, if an action didn’t complete by then. Timeouts can be a way of handling runtime errors, but one should generally be prudent about their usage. Indiscriminate a...

Continue Reading
12/11/2022
Asio 201 - deferred

Asio deferred Aysnc operations Asio introduced the concept of an async_operation, which describes a primary expression that can be invoked with a completion token. In C++20 this is also a language concept. asio::io_context ctx; asio::async_operation auto post_op = [&](auto && token){return asio::post(ctx, std::move(token));}; auto f = post_op(asio::use_future); ctx.run(); f.get(); // void Async operations can be used in parallel_group and directly co_awaited in C++20. asio:...

Continue Reading
11/16/2022
New in Boost 1.81

New Library: Url Boost.url has been released. And it’s awesome. Json & Describe Boost.json is now integrated with Boost.describe. That means that any class, struct, or enum that has describe annotations can be directly serialized to and from json. You can fine examples here. Additionally, variant2 is also supported. Unordered Unordered got a new map type, unordered_flat_map, and the corresponding set type unordered_flat_set. These two containers lay out the map in a flat array, i...

Continue Reading
08/10/2022
Richard's August Update

Beast and HTTP Redirect Some months ago, I was asked how to handle HTTP redirect responses in beast. Characteristically, I took a moment to model how I would do that in my head, waved my hands and kind of explained it and that was that. Then more recently, someone else asked how beast websockets would handle a redirect response when performing a websocket handshake. Now I’m pretty sure that websocket clients have no requirement at all to follow redirects. I believe the WebSocket specific...

Continue Reading
03/12/2022
CppCast; New C++ Scope and Debugging Support

This week I got the opportunity to chat with Rob and Jason about the open letters to the C++ committee I wrote on CppCast. The letters propose to expand the scope of the C++ standards work to include the ecosystem of tools and related technologies.

Continue Reading