32 lines
1.0 KiB
C++
32 lines
1.0 KiB
C++
// Fill out your copyright notice in the Description page of Project Settings.
|
|
|
|
|
|
#include "UI/Portal/PortalManager.h"
|
|
|
|
#include "HttpModule.h"
|
|
#include "Data/API/APIData.h"
|
|
#include "GameplayTags/DedicatedServerTags.h"
|
|
|
|
void UPortalManager::JoinGameSession()
|
|
{
|
|
BroadcastJoinGameSessionMessage.Broadcast(TEXT("Searching for Game Session..."));
|
|
|
|
check(APIData);
|
|
|
|
TSharedPtr<IHttpRequest> Request = FHttpModule::Get().CreateRequest();
|
|
Request->OnProcessRequestComplete().BindUObject(this, &UPortalManager::FindOrCreateGameSession_Response);
|
|
|
|
const FString APIUrl = APIData->GetAPIEndPoint(DedicatedServersTags::GameSessionsAPI::FindOrCreateGameSession);
|
|
|
|
Request->SetURL(APIUrl);
|
|
Request->SetVerb("POST");
|
|
Request->SetHeader("Content-Type", "application/json");
|
|
Request->ProcessRequest();
|
|
}
|
|
|
|
void UPortalManager::FindOrCreateGameSession_Response(FHttpRequestPtr Request, FHttpResponsePtr Response,
|
|
bool bWasSuccessful)
|
|
{
|
|
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("Find or Create Game Session Response Received"));
|
|
}
|