11 std::shared_ptr<Vruta::NetworkSource> source,
17 if (promise.should_terminate) {
21 auto msg =
co_await source->next_message();
27 std::shared_ptr<Vruta::NetworkSource> source,
28 std::string sender_address,
34 if (promise.should_terminate) {
38 auto msg =
co_await source->next_message();
40 if (msg.sender_address == sender_address) {
47 std::shared_ptr<Vruta::NetworkSource> source,
54 if (promise.should_terminate) {
58 auto msg =
co_await source->next_message();
Coroutine type for event-driven suspension.
Vruta::Event on_message_matching(std::shared_ptr< Vruta::NetworkSource > source, std::function< bool(const Core::NetworkMessage &)> predicate, std::function< void(const Core::NetworkMessage &)> callback)
Creates an Event coroutine that fires only when a predicate matches.
Vruta::Event on_message_from(std::shared_ptr< Vruta::NetworkSource > source, std::string sender_address, std::function< void(const Core::NetworkMessage &)> callback)
Creates an Event coroutine that fires only for messages from a specific sender.
Vruta::Event on_message(std::shared_ptr< Vruta::NetworkSource > source, std::function< void(const Core::NetworkMessage &)> callback)
Creates an Event coroutine that fires on every message received by a source.
A received datagram or framed message with sender metadata.
Event-domain promise accessor with optional NetworkSource ownership transfer.