Lesson 80 - Serializing Content
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user