Other Push Events
Connected
IPushClient::set_connected_callback
Description
Callback for successful connection
Parameters
None
Return
None
Example
#include "tigerapi/push_client.h"
#include "tigerapi/client_config.h"
using namespace TIGER_API;
ClientConfig config(false, U("/path/to/your/properties/"));
auto push_client = IPushClient::create_push_client(config);
push_client->set_connected_callback([]() {
std::cout << "connected" << std::endl;
});
push_client->connect();Disconnected
IPushClient::set_disconnected_callback
Description
Callback for connection disconnection
Parameters
None
Return
None
Example
push_client->set_disconnected_callback([]() {
std::cout << "disconnected, reconnecting..." << std::endl;
// Reconnection logic
push_client->connect();
});
// push_client initialization steps omitted, same as aboveConnection Error
IPushClient::set_error_callback
Description
Callback for connection errors
Parameters
Error message parameter
Return
None
Example
push_client->set_error_callback([](const std::string& error_msg) {
std::cout << "Error: " << error_msg << std::endl;
});
// push_client initialization steps omitted, same as aboveConnection Kicked Out
IPushClient::set_kickout_callback
Description
Callback for being kicked out. When multiple devices are connected, an older device will receive this callback when a newer device connects.
Parameters
Kickout error message parameter
Return
None
Example
push_client->set_kickout_callback([](const std::string& msg) {
std::cout << "kickout callback: " << msg << std::endl;
});
// push_client initialization steps omitted, same as aboveUpdated 1 day ago
