UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FBackgroundHttpRequestImpl Class Reference

#include <BackgroundHttpRequestImpl.h>

+ Inheritance diagram for FBackgroundHttpRequestImpl:

Public Member Functions

BACKGROUNDHTTP_API FBackgroundHttpRequestImpl ()
 
virtual ~FBackgroundHttpRequestImpl ()
 
virtual BACKGROUNDHTTP_API void OnBackgroundDownloadComplete ()
 
virtual BACKGROUNDHTTP_API bool ProcessRequest () override
 
virtual BACKGROUNDHTTP_API void CancelRequest () override
 
virtual BACKGROUNDHTTP_API void PauseRequest () override
 
virtual BACKGROUNDHTTP_API void ResumeRequest () override
 
virtual BACKGROUNDHTTP_API void SetURLAsList (const TArray< FString > &URLs, int NumRetriesToAttempt) override
 
virtual BACKGROUNDHTTP_API const TArray< FString > & GetURLList () const override
 
virtual BACKGROUNDHTTP_API void SetExpectedResultSize (const uint64 ExpectedSize) override
 
virtual BACKGROUNDHTTP_API uint64 GetExpectedResultSize () const override
 
virtual BACKGROUNDHTTP_API void SetCompleteNotification (FBackgroundHttpNotificationObjectPtr DownloadCompleteNotificationObjectIn) override
 
virtual BACKGROUNDHTTP_API void CompleteWithExistingResponseData (FBackgroundHttpResponsePtr BackgroundResponse) override
 
virtual BACKGROUNDHTTP_API FBackgroundHttpRequestCompleteDelegateOnProcessRequestComplete () override
 
virtual BACKGROUNDHTTP_API FBackgroundHttpProgressUpdateDelegateOnProgressUpdated () override
 
virtual BACKGROUNDHTTP_API FBackgroundHttpRequestMetricsDelegateOnRequestMetrics () override
 
virtual BACKGROUNDHTTP_API FBackgroundHttpRequestMetricsExtendedDelegateOnRequestMetricsExtended () override
 
virtual BACKGROUNDHTTP_API const FBackgroundHttpResponsePtr GetResponse () const override
 
virtual BACKGROUNDHTTP_API const FString & GetRequestID () const override
 
virtual BACKGROUNDHTTP_API void SetRequestID (const FString &NewRequestID) override
 
virtual BACKGROUNDHTTP_API bool HandleDelayedProcess () override
 
virtual BACKGROUNDHTTP_API EBackgroundHTTPPriority GetRequestPriority () const override
 
virtual BACKGROUNDHTTP_API void SetRequestPriority (EBackgroundHTTPPriority NewPriority) override
 
virtual BACKGROUNDHTTP_API void NotifyNotificationObjectOfComplete (const bool bWasSuccess)
 
virtual BACKGROUNDHTTP_API void NotifyRequestMetricsAvailable (const int32 TotalBytesDownloaded, const float DownloadDuration)
 
virtual BACKGROUNDHTTP_API void NotifyRequestMetricsExtendedAvailable (const FBackgroundHttpRequestMetricsExtended ExtendedMetrics)
 
virtual BACKGROUNDHTTP_API void SetMetrics (const int32 TotalBytesDownloaded, const float DownloadDuration) override
 
virtual BACKGROUNDHTTP_API void SetMetricsExtended (const FBackgroundHttpRequestMetricsExtended ExtendedMetrics) override
 
- Public Member Functions inherited from IBackgroundHttpRequest
virtual ~IBackgroundHttpRequest ()=default
 
virtual void GetDebugText (TArray< FString > &Output)
 
- Public Member Functions inherited from TSharedFromThis< IBackgroundHttpRequest, ESPMode::ThreadSafe >
TSharedRef< IBackgroundHttpRequest, Mode > AsShared ()
 
TSharedRef< IBackgroundHttpRequest const, Mode > AsShared () const
 
TSharedRef< SubobjectType, Mode > AsSharedSubobject (SubobjectType *SubobjectPtr) const
 
TWeakPtr< IBackgroundHttpRequest, Mode > AsWeak ()
 
TWeakPtr< IBackgroundHttpRequest const, Mode > AsWeak () const
 
TWeakPtr< SubobjectType, Mode > AsWeakSubobject (SubobjectType *SubobjectPtr) const
 
void UpdateWeakReferenceInternal (TSharedPtr< SharedPtrType, SharedPtrMode > const *InSharedPtr, OtherType *InObject) const
 
void UpdateWeakReferenceInternal (TSharedRef< SharedRefType, SharedPtrMode > const *InSharedRef, OtherType *InObject) const
 
UE_FORCEINLINE_HINT bool DoesSharedInstanceExist () const
 

Protected Types

using FDownloadMetricsInfo = FBackgroundHttpRequestMetricsExtended
 

Protected Attributes

UE::FMutex DownloadCompleteMutex
 
TSharedPtr< FBackgroundHttpNotificationObject, ESPMode::ThreadSafeDownloadCompleteNotificationObject
 
FBackgroundHttpResponsePtr Response
 
TArray< FString > URLList
 
FString RequestID
 
int NumberOfTotalRetries
 
EBackgroundHTTPPriority RequestPriority
 
uint64 ExpectedResultSize
 
TOptional< FDownloadMetricsInfoOptionalMetricsInfo
 
FBackgroundHttpRequestCompleteDelegate HttpRequestCompleteDelegate
 
FBackgroundHttpProgressUpdateDelegate HttpProgressUpdateDelegate
 
FBackgroundHttpRequestMetricsDelegate HttpRequestMetricsDelegate
 
FBackgroundHttpRequestMetricsExtendedDelegate HttpRequestMetricsExtendedDelegate
 

Additional Inherited Members

- Protected Member Functions inherited from TSharedFromThis< IBackgroundHttpRequest, ESPMode::ThreadSafe >
 TSharedFromThis ()
 
 TSharedFromThis (TSharedFromThis const &)
 
UE_FORCEINLINE_HINT TSharedFromThisoperator= (TSharedFromThis const &)
 
 ~TSharedFromThis ()
 
- Static Protected Member Functions inherited from TSharedFromThis< IBackgroundHttpRequest, ESPMode::ThreadSafe >
static UE_FORCEINLINE_HINT TSharedRef< OtherType, Mode > SharedThis (OtherType *ThisPtr)
 
static UE_FORCEINLINE_HINT TSharedRef< OtherType const, Mode > SharedThis (const OtherType *ThisPtr)
 

Detailed Description

Contains implementation of some common functions that don't have to vary between implementation

Member Typedef Documentation

◆ FDownloadMetricsInfo

Constructor & Destructor Documentation

◆ FBackgroundHttpRequestImpl()

FBackgroundHttpRequestImpl::FBackgroundHttpRequestImpl ( )

◆ ~FBackgroundHttpRequestImpl()

virtual FBackgroundHttpRequestImpl::~FBackgroundHttpRequestImpl ( )
inlinevirtual

Member Function Documentation

◆ CancelRequest()

void FBackgroundHttpRequestImpl::CancelRequest ( )
overridevirtual

Called to cancel a request that is still being processed

Implements IBackgroundHttpRequest.

Reimplemented in FGenericPlatformBackgroundHttpRequest.

◆ CompleteWithExistingResponseData()

void FBackgroundHttpRequestImpl::CompleteWithExistingResponseData ( FBackgroundHttpResponsePtr  BackgroundResponse)
overridevirtual

Function used to complete an IHttpBackgroundRequest from an external source, passing it in a pre-existing response data.

Parameters
BackgroundReponse,ASharedRef to the already existing IHttpBackgroundResponse we want to base this tasks' Response off of.

Implements IBackgroundHttpRequest.

Reimplemented in FGenericPlatformBackgroundHttpRequest.

◆ GetExpectedResultSize()

uint64 FBackgroundHttpRequestImpl::GetExpectedResultSize ( ) const
overridevirtual

Returns expected result size for the request, set by SetExpectedResultSize.

Returns
Expected result size in bytes.

Reimplemented from IBackgroundHttpRequest.

◆ GetRequestID()

const FString & FBackgroundHttpRequestImpl::GetRequestID ( ) const
overridevirtual

Gets the associated RequestID for this BackgroundDownload.

Returns
The RequestID

Implements IBackgroundHttpRequest.

◆ GetRequestPriority()

EBackgroundHTTPPriority FBackgroundHttpRequestImpl::GetRequestPriority ( ) const
overridevirtual

Gets the associated Requeset's Priority for Background Downloadings. Where possible, we attempt to finish downloads in lowest-priority first order.

Returns
The request Priority

Implements IBackgroundHttpRequest.

◆ GetResponse()

const FBackgroundHttpResponsePtr FBackgroundHttpRequestImpl::GetResponse ( ) const
overridevirtual

Get the associated Response

Returns
the response

Implements IBackgroundHttpRequest.

◆ GetURLList()

const TArray< FString > & FBackgroundHttpRequestImpl::GetURLList ( ) const
overridevirtual

Gets the current URL List that this background request is currently processing.

Returns
List of URLs as FStrings

Implements IBackgroundHttpRequest.

◆ HandleDelayedProcess()

bool FBackgroundHttpRequestImpl::HandleDelayedProcess ( )
overridevirtual

Called by certain platform's implementation when we have to wait for the BackgroundHttpManager / PlatformBackgroundHttp to do some work before we can finish our ProcessRequest call. Should only be called by different platform layers.

NOTE: Should really only be called by the BackgroundHttpManager! You are probably looking for ProcessRequest.

Returns
if the request was successfully handled.

Implements IBackgroundHttpRequest.

Reimplemented in FGenericPlatformBackgroundHttpRequest.

◆ NotifyNotificationObjectOfComplete()

void FBackgroundHttpRequestImpl::NotifyNotificationObjectOfComplete ( const bool  bWasSuccess)
virtual

◆ NotifyRequestMetricsAvailable()

void FBackgroundHttpRequestImpl::NotifyRequestMetricsAvailable ( const int32  TotalBytesDownloaded,
const float  DownloadDuration 
)
virtual

◆ NotifyRequestMetricsExtendedAvailable()

void FBackgroundHttpRequestImpl::NotifyRequestMetricsExtendedAvailable ( const FBackgroundHttpRequestMetricsExtended  ExtendedMetrics)
virtual

◆ OnBackgroundDownloadComplete()

void FBackgroundHttpRequestImpl::OnBackgroundDownloadComplete ( )
virtual

◆ OnProcessRequestComplete()

FBackgroundHttpRequestCompleteDelegate & FBackgroundHttpRequestImpl::OnProcessRequestComplete ( )
overridevirtual

Delegate called when the request is complete. See FBackgroundHttpRequestCompleteDelegate

Implements IBackgroundHttpRequest.

◆ OnProgressUpdated()

FBackgroundHttpProgressUpdateDelegate & FBackgroundHttpRequestImpl::OnProgressUpdated ( )
overridevirtual

Delegate called when the request has a progress update.

Implements IBackgroundHttpRequest.

◆ OnRequestMetrics()

FBackgroundHttpRequestMetricsDelegate & FBackgroundHttpRequestImpl::OnRequestMetrics ( )
overridevirtual

Delegate called when the request's metrics were calculated

Implements IBackgroundHttpRequest.

◆ OnRequestMetricsExtended()

FBackgroundHttpRequestMetricsExtendedDelegate & FBackgroundHttpRequestImpl::OnRequestMetricsExtended ( )
overridevirtual

Delegate called when the request's extended metrics were calculated

Implements IBackgroundHttpRequest.

◆ PauseRequest()

void FBackgroundHttpRequestImpl::PauseRequest ( )
overridevirtual

Called to pause a request that is still being processed

Implements IBackgroundHttpRequest.

Reimplemented in FApplePlatformBackgroundHttpRequest.

◆ ProcessRequest()

bool FBackgroundHttpRequestImpl::ProcessRequest ( )
overridevirtual

Called to begin processing the request. OnProcessRequestComplete delegate is always called when the request completes or on error if it is bound. A request can be re-used but not while still being processed.

Returns
if the request was successfully started.

Implements IBackgroundHttpRequest.

◆ ResumeRequest()

void FBackgroundHttpRequestImpl::ResumeRequest ( )
overridevirtual

Called to resume a request that was previously paused

Implements IBackgroundHttpRequest.

Reimplemented in FApplePlatformBackgroundHttpRequest.

◆ SetCompleteNotification()

void FBackgroundHttpRequestImpl::SetCompleteNotification ( FBackgroundHttpNotificationObjectPtr  DownloadCompleteNotificationObject)
overridevirtual

Sets an FHTTPRequestDownloadNotificationObject to be mapped to this HTTPRequest. This request will keep the particular FHttpRequestDownloadNotificationObject reference until it completes. To use this function make sure you keep a reference to the supplied DownloadNotificationObject until you have created all the different IHTTPRequest that you would like to use it. Then delete your reference. Once all references are removed (by each Request completing) a callback set on the DownloadCompleteDelegateObject will be called

Parameters
DownloadCompleteDelegateObjectThe particular download complete delegate object

Implements IBackgroundHttpRequest.

◆ SetExpectedResultSize()

void FBackgroundHttpRequestImpl::SetExpectedResultSize ( const uint64  ExpectedSize)
overridevirtual

Sets expected result size for the request, might be used by the implementation to check file size before invoking completion notification. Must be called before ProcessRequest.

Parameters
ExpectedSizeexpected file size in bytes, 0 to disable the check. Default value is 0.

Reimplemented from IBackgroundHttpRequest.

◆ SetMetrics()

void FBackgroundHttpRequestImpl::SetMetrics ( const int32  TotalBytesDownloaded,
const float  DownloadDuration 
)
overridevirtual

Set metrics for analytics event

Reimplemented from IBackgroundHttpRequest.

◆ SetMetricsExtended()

void FBackgroundHttpRequestImpl::SetMetricsExtended ( const FBackgroundHttpRequestMetricsExtended  ExtendedMetrics)
overridevirtual

Set extended metrics for analytics event

Reimplemented from IBackgroundHttpRequest.

◆ SetRequestID()

void FBackgroundHttpRequestImpl::SetRequestID ( const FString &  NewRequestID)
overridevirtual

Sets the associated RequestID for this BackgroundDownload. Useful as we associate a background downlaod with multiple URLs, so this provides an easier way to identify the download with 1 string instead of checking multiple URLs.

Parameters
NewRequestIDFString to set the Request ID to.

Implements IBackgroundHttpRequest.

◆ SetRequestPriority()

void FBackgroundHttpRequestImpl::SetRequestPriority ( EBackgroundHTTPPriority  NewPriority)
overridevirtual

Sets the associated Requeset's Priority for Background Downloadings. Where possible, we attempt to finish downloads in lowest-priority first order.

Parameters
uint32describing priority of this download. Lower happens first and thus 0 is the highest priority.

Implements IBackgroundHttpRequest.

◆ SetURLAsList()

void FBackgroundHttpRequestImpl::SetURLAsList ( const TArray< FString > &  URLs,
int  NumRetriesToAttempt 
)
overridevirtual

Sets up a list of URLs to automatically fall through as each one fails. Must be called before ProcessRequest.

Parameters
URLslist of URLs. Eg: download.epicgames.com/downloadfilehere.txt, download2.epicgames.com/downloadfilehere.txt, download3.epicgames/downloadfilehere.txt
NumRetriesToAttemptHow many times we want to fall through and try different URLS. Loops back to the beginning of the list if NumRetries > URLs.Num()

Implements IBackgroundHttpRequest.

Member Data Documentation

◆ DownloadCompleteMutex

UE::FMutex FBackgroundHttpRequestImpl::DownloadCompleteMutex
protected

◆ DownloadCompleteNotificationObject

TSharedPtr<FBackgroundHttpNotificationObject, ESPMode::ThreadSafe> FBackgroundHttpRequestImpl::DownloadCompleteNotificationObject
protected

◆ ExpectedResultSize

uint64 FBackgroundHttpRequestImpl::ExpectedResultSize
protected

◆ HttpProgressUpdateDelegate

FBackgroundHttpProgressUpdateDelegate FBackgroundHttpRequestImpl::HttpProgressUpdateDelegate
protected

◆ HttpRequestCompleteDelegate

FBackgroundHttpRequestCompleteDelegate FBackgroundHttpRequestImpl::HttpRequestCompleteDelegate
protected

◆ HttpRequestMetricsDelegate

FBackgroundHttpRequestMetricsDelegate FBackgroundHttpRequestImpl::HttpRequestMetricsDelegate
protected

◆ HttpRequestMetricsExtendedDelegate

FBackgroundHttpRequestMetricsExtendedDelegate FBackgroundHttpRequestImpl::HttpRequestMetricsExtendedDelegate
protected

◆ NumberOfTotalRetries

int FBackgroundHttpRequestImpl::NumberOfTotalRetries
protected

◆ OptionalMetricsInfo

TOptional<FDownloadMetricsInfo> FBackgroundHttpRequestImpl::OptionalMetricsInfo
protected

◆ RequestID

FString FBackgroundHttpRequestImpl::RequestID
protected

◆ RequestPriority

EBackgroundHTTPPriority FBackgroundHttpRequestImpl::RequestPriority
protected

◆ Response

FBackgroundHttpResponsePtr FBackgroundHttpRequestImpl::Response
protected

◆ URLList

TArray<FString> FBackgroundHttpRequestImpl::URLList
protected

The documentation for this class was generated from the following files: