HttpReceiveTimeout

HttpReceiveTimeout

#Overview

name: HttpReceiveTimeout

The value of this variable can be defined or overridden in .ini config files. 1 .ini config file referencing this setting variable.

It is referenced in 4 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of HttpReceiveTimeout is to set a timeout value in seconds for receiving a response on an HTTP connection. This setting is part of Unreal Engine’s HTTP module, which is responsible for handling HTTP communications in the engine.

The HTTP module relies on this setting variable. It’s primarily used in the FHttpModule class, which is part of the Online subsystem of Unreal Engine.

The value of this variable is set in multiple places:

  1. It’s initialized in the FHttpModule::StartupModule() function with a default value equal to HttpConnectionTimeout (which is set to 30.0f).
  2. It can be overridden by configuration settings in the engine’s INI files, specifically in the [HTTP] section of the engine configuration file (GEngineIni). This is done in the FHttpModule::UpdateConfigs() function.

HttpReceiveTimeout interacts with other HTTP-related variables such as HttpConnectionTimeout, HttpActivityTimeout, and HttpSendTimeout. These variables collectively control various aspects of HTTP connection behavior.

Developers must be aware that this timeout affects how long the engine will wait to receive a response from an HTTP request before considering it failed. Setting it too low might cause premature timeouts for slow connections or large responses, while setting it too high could lead to long waits for failed requests.

Best practices when using this variable include:

  1. Adjust it based on the expected response times of your server and the nature of your HTTP requests.
  2. Consider the network conditions of your target audience when setting this value.
  3. Use it in conjunction with other timeout settings (like HttpConnectionTimeout and HttpActivityTimeout) to create a robust HTTP request handling system.
  4. Be cautious when modifying this value, as it can significantly impact the user experience and the performance of network-dependent features in your game or application.
  5. Monitor and log timeout occurrences to fine-tune this setting for your specific use case.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/ConfigRedirects.ini:62, section: [HTTP]

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Runtime/Online/HTTP/Private/HttpModule.cpp:55

Scope (from outer to inner):

file
function     void FHttpModule::UpdateConfigs

Source code excerpt:

	GConfig->GetFloat(TEXT("HTTP"), TEXT("HttpConnectionTimeout"), HttpConnectionTimeout, GEngineIni);
	GConfig->GetFloat(TEXT("HTTP"), TEXT("HttpActivityTimeout"), HttpActivityTimeout, GEngineIni);
	GConfig->GetFloat(TEXT("HTTP"), TEXT("HttpReceiveTimeout"), HttpReceiveTimeout, GEngineIni);
	GConfig->GetFloat(TEXT("HTTP"), TEXT("HttpSendTimeout"), HttpSendTimeout, GEngineIni);
	GConfig->GetInt(TEXT("HTTP"), TEXT("HttpMaxConnectionsPerServer"), HttpMaxConnectionsPerServer, GEngineIni);
	GConfig->GetBool(TEXT("HTTP"), TEXT("bEnableHttp"), bEnableHttp, GEngineIni);
	GConfig->GetBool(TEXT("HTTP"), TEXT("bUseNullHttp"), bUseNullHttp, GEngineIni);
	GConfig->GetFloat(TEXT("HTTP"), TEXT("HttpDelayTime"), HttpDelayTime, GEngineIni);
	GConfig->GetFloat(TEXT("HTTP"), TEXT("HttpThreadActiveFrameTimeInSeconds"), HttpThreadActiveFrameTimeInSeconds, GEngineIni);

#Loc: <Workspace>/Engine/Source/Runtime/Online/HTTP/Private/HttpModule.cpp:89

Scope (from outer to inner):

file
function     void FHttpModule::StartupModule

Source code excerpt:

	HttpConnectionTimeout = 30.0f;
	HttpActivityTimeout = 30.0f;
	HttpReceiveTimeout = HttpConnectionTimeout;
	HttpSendTimeout = HttpConnectionTimeout;
	HttpMaxConnectionsPerServer = 16;
	bEnableHttp = true;
	bUseNullHttp = false;
	HttpDelayTime = 0;
	HttpThreadActiveFrameTimeInSeconds = 1.0f / 200.0f; // 200Hz

#Loc: <Workspace>/Engine/Source/Runtime/Online/HTTP/Public/HttpModule.h:121

Scope (from outer to inner):

file
class        class FHttpModule : public IModuleInterface, public FSelfRegisteringExec
function     inline float GetHttpReceiveTimeout

Source code excerpt:

	inline float GetHttpReceiveTimeout() const
	{
		return HttpReceiveTimeout;
	}

	/**
	 * @return timeout in seconds to send a request on the connection
	 */
	UE_DEPRECATED(5.4, "GetHttpSendTimeout has been deprecated, The legacy behavior doesn't make use of HttpSendTimeout at all, and there is no such support on some platforms. Use GetHttpActivityTimeout instead to decide if there is still any ongoing activity.")

#Loc: <Workspace>/Engine/Source/Runtime/Online/HTTP/Public/HttpModule.h:378

Scope (from outer to inner):

file
class        class FHttpModule : public IModuleInterface, public FSelfRegisteringExec

Source code excerpt:

	FHttpManager* HttpManager = nullptr;
	/** timeout in seconds to receive a response on the connection */
	float HttpReceiveTimeout;
	/** timeout in seconds to send a request on the connection */
	float HttpSendTimeout;
	/** total time to delay the request */
	float HttpDelayTime;
	/** Time in seconds to use as frame time when actively processing requests. 0 means no frame time. */
	float HttpThreadActiveFrameTimeInSeconds;