As reported in chat, examples/web_socket/echo is broken in 0.19. Connection aborts right after clients connect. With this patch:
diff --git a/examples/web_socket/echo.cpp b/examples/web_socket/echo.cpp
index 86163f5e0..b1b995b94 100644
--- a/examples/web_socket/echo.cpp
+++ b/examples/web_socket/echo.cpp
@@ -93,17 +93,25 @@ 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_next([](const ws::frame& x) {
- if (x.is_binary()) {
- std::cout
- << "*** received a binary WebSocket frame of size "
- << x.size() << '\n';
- } else {
- std::cout
- << "*** received a text WebSocket frame of size "
- << x.size() << '\n';
- }
+ .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
+ << "*** received a binary WebSocket frame of size "
+ << x.size() << '\n';
+ } else {
+ std::cout
+ << "*** received a text WebSocket frame of size "
+ << x.size() << '\n';
+ }
+ })
.subscribe(push);
});
});
I get: *** connection closed: caf::sec::disposed("destroyed producer_resource without opening it").
As reported in chat,
examples/web_socket/echois broken in 0.19. Connection aborts right after clients connect. With this patch:I get:
*** connection closed: caf::sec::disposed("destroyed producer_resource without opening it").