Reference

boost::redis::basic_connection::async_receive

Receives server side pushes asynchronously.

Synopsis

template<class CompletionToken = asio::default_completion_token_t<executor_type>>
auto
async_receive(CompletionToken&& token = {});

Description

When pushes arrive and there is no async_receive operation in progress, pushed data, requests, and responses will be paused until async_receive is called again. Apps will usually want to call async_receive in a loop.

To cancel an ongoing receive operation apps should call basic_connection::cancel(operation::receive).

For an example see cpp20_subscriber.cpp. The completion token must have the following signature

void f(system::error_code, std::size_t);

Where the second parameter is the size of the push received in bytes.

Parameters

Name

Description

token

Completion token.

Created with MrDocs