boost::redis::push_parser :: Boost.Redis

# boost::redis::push_parser

A range that parses Pub/Sub messages from a sequence of RESP3 nodes.

## Synopsis

Declared in `<boost/redis/push_parser.hpp>`

    class push_parser;

## Description

Given an input range of RESP3 nodes, this class attempts to parse them as Pub/Sub messages. Parsing occurs incrementally, while advancing the iterators.

This type models `std::input_range`.

This class handles pushes with type `message` and `pmessage` with string payloads. These are the messages containing the actual information in the usual Pub/Sub workflow. Any RESP3 message with a different shape will be skipped. In particular, the following message types are skipped:

- Messages with type other than `resp3::type::push`. This includes the output of the `MONITOR` command and errors.

- Subscribe and unsubscribe confirmation messages. These happen every time a `SUBSCRIBE`, `UNSUBSCRIBE`, `PSUBSCRIBE` or `PUNSUBSCRIBE` command is successfully executed, and don't carry application‐level information.

- Pushes with type `message` and `pmessage` with a payload type different to `resp3::type::blob_string`. Client‐side caching generates this kind of messages.

If you need to handle any of these, use the raw RESP3 nodes rather than this class.

## Object lifetimes

Iteration state is held by the parser. Iterators reference the parser. The parser must be kept alive for the duration of the iteration.

No copies of the input range are made. The returned `push_view` values are views.

## Example

    for (const push_view& msg : push_parser(tree)) {
       std::cout << "Channel: " << msg.channel << ", Payload: " << msg.payload << "\n";
    }

## Types

Name | Description
`iterator` | Iterator over parsed Pub/Sub messages.

## Member Functions

Name | Description
`push_parser` [constructor] | Constructs a parser over a range of RESP3 nodes.
`begin` | Returns an iterator to the first parsed Pub/Sub message.
`end` | Returns a past‐the‐end iterator.

Created with MrDocs