FriendsUrl
FriendsUrl
#Overview
name: FriendsUrl
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 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of FriendsUrl is to store the URL used for querying the friends list in the Facebook Online Subsystem of Unreal Engine 5. This variable is specifically used for interacting with Facebook’s API to retrieve friend information for the game’s online functionality.
The Unreal Engine subsystem that relies on this setting variable is the Online Subsystem, specifically the Facebook implementation. It is part of the OnlineSubsystemFacebook plugin.
The value of this variable is set from the configuration file (DefaultEngine.ini) under the [OnlineSubsystemFacebook.OnlineFriendsFacebook] section. If the value is not found in the configuration, a warning log is generated.
This variable interacts with other variables and fields, such as:
- FriendsFields: An array of fields to be requested when querying the friends list.
- AccessToken: Used to authenticate the request to Facebook’s API.
- APIVer: The Facebook API version, which is inserted into the URL.
Developers must be aware of the following when using this variable:
- The URL should be properly formatted and include placeholders for dynamic values (e.g.,
ver,
fields, `token). - The URL must be compatible with Facebook’s API structure and expectations.
- Any changes to Facebook’s API might require updates to this URL.
Best practices when using this variable include:
- Always provide a valid FriendsUrl in the configuration file to avoid warnings and ensure proper functionality.
- Regularly review and update the URL to match any changes in Facebook’s API.
- Ensure that the URL includes all necessary parameters and fields required for your specific use case.
- Use placeholders in the URL for dynamic values to make it more flexible and easier to maintain.
- Implement proper error handling and logging around the use of this URL to quickly identify and debug any issues that may arise during API interactions.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseEngine.ini:2294, section: [OnlineSubsystemFacebook.OnlineFriendsFacebook]
- INI Section:
OnlineSubsystemFacebook.OnlineFriendsFacebook
- Raw value:
"https://graph.facebook.com/
ver/me/friends?fields=fields&access_token=
token"` - Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystemFacebook/Source/Private/OnlineFriendsFacebookCommon.cpp:80
Scope (from outer to inner):
file
function FOnlineFriendsFacebookCommon::FOnlineFriendsFacebookCommon
Source code excerpt:
check(FacebookSubsystem);
if (!GConfig->GetString(TEXT("OnlineSubsystemFacebook.OnlineFriendsFacebook"), TEXT("FriendsUrl"), FriendsUrl, GEngineIni))
{
UE_LOG_ONLINE_FRIEND(Warning, TEXT("Missing FriendsUrl= in [OnlineSubsystemFacebook.OnlineFriendsFacebook] of DefaultEngine.ini"));
}
FriendsUrl.ReplaceInline(TEXT("`ver"), *InSubsystem->GetAPIVer());
GConfig->GetArray(TEXT("OnlineSubsystemFacebook.OnlineFriendsFacebook"), TEXT("FriendsFields"), FriendsFields, GEngineIni);
// always required fields
FriendsFields.AddUnique(TEXT(FRIEND_FIELD_ID));
FriendsFields.AddUnique(TEXT(FRIEND_FIELD_NAME));
#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystemFacebook/Source/Private/OnlineFriendsFacebookCommon.cpp:154
Scope (from outer to inner):
file
function bool FOnlineFriendsFacebookCommon::ReadFriendsList
Source code excerpt:
// build the url
FString FriendsQueryUrl = FriendsUrl.Replace(TEXT("`fields"), *FieldsStr, ESearchCase::IgnoreCase);
FriendsQueryUrl = FriendsQueryUrl.Replace(TEXT("`token"), *AccessToken, ESearchCase::IgnoreCase);
// kick off http request to read friends
HttpRequest->OnProcessRequestComplete().BindRaw(this, &FOnlineFriendsFacebookCommon::QueryFriendsList_HttpRequestComplete, Delegate);
HttpRequest->SetURL(FriendsQueryUrl);
HttpRequest->SetHeader(TEXT("Content-Type"), TEXT("application/json"));
#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystemFacebook/Source/Private/OnlineFriendsFacebookCommon.h:167
Scope (from outer to inner):
file
class class FOnlineFriendsFacebookCommon : public IOnlineFriends
Source code excerpt:
FOnlineSubsystemFacebook* FacebookSubsystem;
/** Config based url for querying friends list */
FString FriendsUrl;
/** Config based list of fields to use when querying friends list */
TArray<FString> FriendsFields;
/** List of online friends */
struct FOnlineFriendsList
{