RegisterAutoReconnectCallback
Registers a callback handler that is invoked whenever the client automatically re-authenticates due to session expiration. The callback receives a JSON string describing the result of the re-authentication attempt, whether successful or failed.
This callback is used in conjunction with EnableAutoReconnect on the wrapper (or EnableAutoReconnect on the comms layer directly).
Method Parameters
| Parameter | Description |
|---|---|
| callback | A LongSessionCallback delegate that takes a JSON response string as its only parameter. |
Usage
http://localhost:3000
- C#
- C++
- Objective-C
- Java
- JavaScript
- Dart
- Roblox
- Cloud Code
- Raw
void autoReconnectCallback(string jsonResponse)
{
// handle re-authentication result
}
_bc.RegisterAutoReconnectCallback(autoReconnectCallback);
_bc->registerAutoReconnectCallback(this);
BCLongSessionCompletionBlock autoReconnectBlock = ^(NSString *jsonResponse) {
// handle re-authentication result
};
[_bc registerAutoReconnectCallback:autoReconnectBlock];
_bc.registerAutoReconnectCallback(callback);
_bc.registerAutoReconnectCallback(autoReconnectCallback);
void autoReconnectCallback(String jsonResponse) {
// handle re-authentication result
}
_bc.registerAutoReconnectCallback(autoReconnectCallback);
local function autoReconnectCallback(jsonResponse)
-- handle re-authentication result
end
_bc:registerAutoReconnectCallback(autoReconnectCallback)
// N/A
// N/A
JSON Response
// On success - authentication response JSON
{
"status": 200,
"data": {
"profileId": "1234-1234-1234-1234",
"newUser": false
}
}
// On failure - error response JSON
{
"status": 403,
"reason_code": 40300,
"status_message": "Message describing failure",
"severity": "ERROR"
}