boost::redis::basic_connection::async_receive2
Wait for server pushes asynchronously
Synopsis
Declared in <boost/redis/connection.hpp>
template<class CompletionToken = asio::default_completion_token_t<executor_type>>
auto
async_receive2(CompletionToken&& token = {});
Description
This function suspends until a server push is received by the connection. On completion an unspecified number of pushes will have been added to the response object set with boost::redis::connection::set_receive_response.
To prevent receiving an unbound number of pushes the connection blocks further read operations on the socket when 256 pushes accumulate internally (we don't make any commitment to this exact number). When that happens any async_exec`s and health‐checks won't make any progress and the connection may eventually timeout. To avoid that Apps should call `async_receive2 continuously in a loop.
|
To avoid deadlocks the task (e.g. coroutine) calling |
For an example see cpp20_subscriber.cpp. The completion token must have the following signature
void f(system::error_code);
Per‐operation cancellation
This operation supports the following cancellation types:
-
`asio::cancellation_type_t::terminal`.
-
`asio::cancellation_type_t::partial`.
-
`asio::cancellation_type_t::total`.
Calling basic_connection::cancel(operation::receive) will also cancel any ongoing receive operations.
Parameters
| Name | Description |
|---|---|
token |
Completion token. |
Created with MrDocs