Defining a Connection Callback Function
The callback function you implement to handle connection notification must be declared using the following function prototype.
void (*BrokerConnectionCallback)(BrokerClient client,
int connect_status,
void *client_data);
client | The Broker client whose connection state has changed. |
connect_state | The client's connection state. This will be set to either AW_CONNECT_STATE_DISCONNECTED, AW_CONNECT_STATE_CONNECTED, or AW_CONNECT_STATE_RECONNECTED. |
client_data | Any data that your callback function needs to perform its processing. This data is defined at the time you register your callback function and may be NULL. |
You can implement this function to recreate any needed client state that may have been lost or to provide other functions, such as message logging.