updateToken method

Future<int?> updateToken(
  1. string token
)

@detail api @author luomingkang @brief Updates the Token of the game room.
You must call this API to update token to ensure the RTC call to continue when you receive onTokenWillExpire{@link #IRTCRoomEventHandler#onTokenWillExpire}, onPublishPrivilegeTokenWillExpire{@link #IRTCRoomEventHandler#onPublishPrivilegeTokenWillExpire}, or onSubscribePrivilegeTokenWillExpire{@link #IRTCRoomEventHandler#onSubscribePrivilegeTokenWillExpire}. @param token Valid token.
If the Token is invalid, you will receive onRoomStateChanged{@link #IRTCRoomEventHandler#onRoomStateChanged} with the error code of -1010. @return API call result:
- 0: Success. - <0: Failure. See ReturnStatus{@link #ReturnStatus} for specific reasons. @note Do not call both updateToken{@link #IGameRoom#updateToken} and joinRoom{@link #IGameRoom#joinRoom} to update the Token. If you fail to join the room or have been removed from the room due to an expired or invalid Token, call joinRoom{@link #IGameRoom#joinRoom} with a valid token to rejoin the room.

Implementation

Future<int?> updateToken(string token) async {
  $a() => ($instance as $p_a.IGameRoom).updateToken(token);
  $i() => ($instance as $p_i.ByteRTCGameRoom).updateToken(token);

  if (Platform.isAndroid) {
    return $a();
  } else if (Platform.isIOS) {
    return $i();
  } else {
    throw UnsupportedError(
        'Not Support Platform ${Platform.operatingSystem}');
  }
}