Promise-Cpp with Boost.Beast
Channel: Utah Cpp Programmers
Date: 2023-06-15

Over the past few months, we've looked at asynchronous I/O and network programming using Boost.Asio and Boost.Beast. Those libraries connect to your application through the use of callbacks. When orchestrating a sequence of asynchronous operations, it is up to the application to ensure that the callbacks are invoked in the proper sequence.

This "callback hell" problem has long been recognized in the JavaScript world, as all I/O operations in JavaScript (timers or XML HTTP Requests) are asynchronous. In the JavaScript world this lead to promise oriented APIs that allowed for a more linear notation in expressing a sequence of asynchronous operations. This led to the Promises/A+ specification for JavaScript promises.

Promise-cpp is an implementation of the Promises/A+ specification for C++. It can integrate with Boost.Asio and Boost.Beast for asynchronous network programming support for low-level I/O as well as HTTP and WebSocket APIs.

Example code: https://github.com/LegalizeAdulthood/promise-cpp-example
Promise-Cpp: https://github.com/xhawk18/promise-cpp

Past topics: https://utahcpp.wordpress.com/past-meeting-topics/
Future topics: https://utahcpp.wordpress.com/future-meeting-topics/

Meetup group: https://www.meetup.com/utah-cpp-programmers/