updateToken method

FutureOr<int> updateToken(
  1. NSString token
)

@detail api @author luomingkang @brief Update the game room token.
You must call this API to update token to ensure the RTC call to continue when you receive onTokenWillExpire:{@link #ByteRTCGameRoomDelegate#onTokenWillExpire}, onPublishPrivilegeTokenWillExpire:{@link #ByteRTCGameRoomDelegate#onPublishPrivilegeTokenWillExpire}, or onSubscribePrivilegeTokenWillExpire:{@link #ByteRTCGameRoomDelegate#onSubscribePrivilegeTokenWillExpire}. @param token Valid token.
If the Token is invalid, you will receive rtcRoom:onRoomStateChangedWithReason:withUid:state:reason:{@link #ByteRTCGameRoomDelegate#rtcRoom:onRoomStateChangedWithReason:withUid:state:reason} with the error code of -1010. @return - 0: Success - !0: Failure @note Do not call both updateToken:{@link #ByteRTCGameRoom#updateToken} and joinRoom:userInfo:{@link #ByteRTCGameRoom#joinRoom:userInfo} 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:userInfo:{@link #ByteRTCGameRoom#joinRoom:userInfo} with a valid token to rejoin the room.

Implementation

FutureOr<int> updateToken(NSString token) async {
  return await nativeCall('updateToken:', [token]);
}