5959// / Invalidation message field names.
6060static  NSString  *const  kTemplateVersionNumberKey  = @" latestTemplateVersionNumber"  ;
6161static  NSString  *const  kIsFeatureDisabled  = @" featureDisabled"  ;
62+ static  NSString  *const  kRealtime_Retry_Interval  = @" retryIntervalSeconds"  ;
6263
6364static  NSTimeInterval  gTimeoutSeconds  = 330 ;
6465static  NSInteger  const  gFetchAttempts  = 3 ;
@@ -521,13 +522,17 @@ - (void)autoFetch:(NSInteger)remainingAttempts targetVersion:(NSInteger)targetVe
521522
522523- (void )evaluateStreamResponse : (NSDictionary  *)response  error : (NSError  *)dataError  {
523524  NSInteger  updateTemplateVersion = 1 ;
525+   NSTimeInterval  realtimeRetryInterval = 0 ;
524526  if  (dataError == nil ) {
525527    if  ([response objectForKey: kTemplateVersionNumberKey ]) {
526528      updateTemplateVersion = [[response objectForKey: kTemplateVersionNumberKey ] integerValue ];
527529    }
528530    if  ([response objectForKey: kIsFeatureDisabled ]) {
529531      self->_isRealtimeDisabled  = [response objectForKey: kIsFeatureDisabled ];
530532    }
533+     if  ([response objectForKey: kRealtime_Retry_Interval ]) {
534+       realtimeRetryInterval = [[response objectForKey: kRealtime_Retry_Interval ] integerValue ];
535+     }
531536
532537    if  (self->_isRealtimeDisabled ) {
533538      [self  pauseRealtimeStream ];
@@ -544,6 +549,14 @@ - (void)evaluateStreamResponse:(NSDictionary *)response error:(NSError *)dataErr
544549      if  (updateTemplateVersion > clientTemplateVersion) {
545550        [self  autoFetch: gFetchAttempts  targetVersion: updateTemplateVersion];
546551      }
552+ 
553+       // / This field in the response indicates that the realtime request has exceeded the project's
554+       // / quota. It will retry after the specified interval to establish a long-lived connection.
555+       // / This interval extends the backoff duration without affecting the number of retries, so it
556+       // / will not enter an exponential backoff state.
557+       if  (realtimeRetryInterval > 0 ) {
558+         [self ->_settings updateRealtimeBackoffTimeWithInterval: realtimeRetryInterval];
559+       }
547560    }
548561  } else  {
549562    NSError  *error =
0 commit comments