Lesson 80 - Serializing Content

This commit is contained in:
Norman Lansing
2026-04-05 17:07:48 -04:00
parent bc219f373d
commit 9837e4e1d6
4 changed files with 45 additions and 0 deletions

View File

@@ -119,4 +119,29 @@ void UPortalManager::HandleGameSessionStatus(const FString& Status, const FStrin
void UPortalManager::TryCreatePlayerSession(const FString& PlayerId, const FString& GameSessionId)
{
BroadcastJoinGameSessionMessage.Broadcast(TEXT("Searching for Game Session..."), false);
check(APIData);
TSharedPtr<IHttpRequest> Request = FHttpModule::Get().CreateRequest();
Request->OnProcessRequestComplete().BindUObject(this, &UPortalManager::FindPlayerSession_Response);
const FString APIUrl = APIData->GetAPIEndPoint(DedicatedServersTags::GameSessionsAPI::CreatePlayerSession);
Request->SetURL(APIUrl);
Request->SetVerb("POST");
Request->SetHeader("Content-Type", "application/json");
TMap<FString, FString> Params = {
{TEXT("playerId"), PlayerId},
{TEXT("sessionId"), GameSessionId}
};
Request->SetContentAsString(SerializeJsonContent(Params));
Request->ProcessRequest();
}
void UPortalManager::FindPlayerSession_Response(FHttpRequestPtr Request, FHttpResponsePtr Response, bool bWasSuccessful)
{
}