updateLoginToken method
@detail api
@author hanchenchen.c
@brief Update the Token
Token used by the user for login has a certain valid period. When the Token expires, you need to call this method to update the login Token information.
When calling the login{@link #RTCEngine#login} method to log in, if an expired token is used, the login will fail and you will receive an onLoginResult{@link #IRTCEngineEventHandler#onLoginResult} callback notification with an error code of 'LOGIN_ERROR_CODE_INVALID_TOKEN'. You need to reacquire the token and call this method to update the token.
@param token
Updated dynamic key
@return
- 0: Success.
- < 0 : Fail. See ReturnStatus{@link #ReturnStatus} for more details
@note
- If the token is invalid and the login fails, the SDK will automatically log in again after updating the token by calling this method, and the user does not need to call the login{@link #RTCEngine#login} method himself.
- Token expires, if you have successfully logged in, it will not be affected. An expired Token error will be notified to the user the next time you log in with an expired Token, or when you log in again due to a disconnection due to poor local network conditions.
Implementation
Future<int?> updateLoginToken(string token) async {
$a() => ($instance as $p_a.RTCEngine).updateLoginToken(token);
$i() => ($instance as $p_i.ByteRTCEngine).updateLoginToken(token);
if (Platform.isAndroid) {
return $a();
} else if (Platform.isIOS) {
return $i();
} else {
throw UnsupportedError(
'Not Support Platform ${Platform.operatingSystem}');
}
}