Skip to content

Adds a convenient way of iterating PubSub messages#390

Merged
anarthal merged 27 commits intoboostorg:developfrom
anarthal:feature/pubsub-message-range
Feb 23, 2026
Merged

Adds a convenient way of iterating PubSub messages#390
anarthal merged 27 commits intoboostorg:developfrom
anarthal:feature/pubsub-message-range

Conversation

@anarthal
Copy link
Collaborator

@anarthal anarthal commented Jan 27, 2026

Adds push_view and push_parser. This is an input view range that allows parsing PubSub messages from a node tree.
Adds a doc page on how to use server pushes.
Adds reference docs to set_receive_response.

close #349

@anarthal anarthal requested a review from mzimbres February 19, 2026 21:48
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My only concern with this PR is that this push parser skips non-push messages silently. This might make it impossible to understand user issues. As we iterate over the messages, would it be possible to the iterator to push a reference to the skipped nodes into the push_parser. then we could at least log them after the loop if necessary

      auto parser = push_parser(resp.value());
      for (push_view elem : parser) {
           ...
      }
      for (auto node : parser.get_skipped()) {
           ...
      }

We could provide a macro to simplify that logging.

@mzimbres
Copy link
Collaborator

Good job, I think we should not delay this anymore as it is very hard to process push without that.

@anarthal
Copy link
Collaborator Author

Hm, storing references would require allocating. I could add an extended API to the parser (or even create a similar push_parser_ext) that also yields skipped messages. For instance:

struct push_view { /* as is today */ };
using push_or_skipped = variant<
   push_view, // a valid push
   span<const resp3::node_view> // skipped message
>;
class push_parser_ext {
   // value type is push_or_skipped
};

I don't think we can make it to this release though (needs to be on master for this Wednesday). So if you're okay with it, I'll merge it as-is, and think of adding this for next release.

I also hope to implement #387 so we can completely get rid of errors in the push buffer, making this issue less important.

@anarthal anarthal merged commit fb9b40e into boostorg:develop Feb 23, 2026
17 checks passed
@anarthal anarthal deleted the feature/pubsub-message-range branch February 23, 2026 14:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The correct parameter type to set_receive_response is neither documented nor enforced.

2 participants