void ping_callback( std::function< void(bool, ping_data const &)> cb);
Sets the callback to be invoked whenever a ping or pong is received during a call to one of the following functions:
Unlike completion handlers, the callback will be invoked for each received ping and pong during a call to any synchronous or asynchronous read function. The operation is passive, with no associated error code, and triggered by reads.
The signature of the callback must be:
void callback( bool is_pong, // `true` if this is a pong ping_data const& payload // Payload of the pong frame );
The value of
true if a pong control
frame is received, and
if a ping control frame is received.
If the read operation receiving a ping or pong frame is an asynchronous operation, the callback will be invoked using the same method as that used to invoke the final handler.
The callback to set.