onTokenWillExpire method
@detail callback
@author shenpengliang
@brief The callback is triggered when the SDK detects the joining room privilege from the Token will expires within 30s.
After receiving this callback, you must call updateToken:{@link #ByteRTCRTSRoom#updateToken} to update the joining room privilege Token.
@param rtcRoom ByteRTCRoom object.
@note After a user's joining room privilege expires:
- When attempting to join a room, the user will receive rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo}with the error code "-1000" indicating that the Token is invalid.
- If the user is already in the room, he/she will be removed from the room and receive rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo} with the error code "-1009" indicating that the Token is expired. Remote users in the room will receive rtcRoom:onUserLeave:reason:{@link #ByteRTCRoomDelegate#rtcRoom:onUserLeave:reason} with the reason "2" indicating that the Token is invalid.
@order 10
Implementation
FutureOr<void> onTokenWillExpire(dynamic rtcRoom) async {
if ($instance == null || $instance is! IRTCRoomEventHandler) {
return;
}
return ($instance as IRTCRoomEventHandler).onTokenWillExpire?.call();
}