Commit f394cc01 authored by Dominik Charousset's avatar Dominik Charousset

Fix flow setup for WebSocket servers

parent 73c3ad38
......@@ -3,6 +3,13 @@
All notable changes to this project will be documented in this file. The format
is based on [Keep a Changelog](https://keepachangelog.com).
## [Unreleased]
### Fixed
- Fix flow setup for servers that use `web_socket::with`. This bug caused
servers to immediately abort incoming connection (#1402).
## [0.19.0] - 2023-04-17
### Added
......
......@@ -93,6 +93,13 @@ int caf_main(caf::actor_system& sys, const config& cfg) {
// ... that simply pushes data back to the sender.
auto [pull, push] = ev.data();
pull.observe_on(self)
.do_on_error([](const caf::error& what) { //
std::cout << "*** connection closed: " << to_string(what)
<< "\n";
})
.do_on_complete([] { //
std::cout << "*** connection closed\n";
})
.do_on_next([](const ws::frame& x) {
if (x.is_binary()) {
std::cout
......@@ -115,7 +122,7 @@ int caf_main(caf::actor_system& sys, const config& cfg) {
return EXIT_FAILURE;
}
// Note: the actor system will keep the application running for as long as the
// workers are still alive.
// worker from .start() is still alive.
return EXIT_SUCCESS;
}
// --(rst-main-end)--
......
......@@ -78,6 +78,7 @@ public:
(*on_request_)(acc);
if (acc.accepted()) {
app_event = std::move(acc.app_event);
ws_resources = std::move(acc.ws_resources);
return {};
}
return std::move(acc) //
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment