I've implemented a basic 1v1 matchmaking for my game in Unreal Engine 4 using the Online Subsystem Plugin for PlayFab (https://github.com/PlayFab/PlayFabMultiplayerUnreal). Matching seems to work correctly, as a session is successfully created for both players.
The issue I'm having is that attempting to make the machine designated as the client travel to the host doesn't work. The client times out after some time.
This is the code I'm using as the delegate for when a match is found successfully:
void UStartMatchmakingCallbackProxy::OnMatchmakingComplete(FName SessionName, bool Successful) { auto SessionsInterface = Online::GetSessionInterface(GEngine->GetWorldFromContextObjectChecked(WorldContextObject)); SessionsInterface->ClearOnMatchmakingCompleteDelegate_Handle(MatchmakingCompleteDelegateHandle); if (Successful) { UE_LOG_ONLINE_SESSION(Log, TEXT("Matchmaking found a match.")); auto NamedSession = SessionsInterface->GetNamedSession(SessionName); if (NamedSession->bHosting) { UE_LOG_ONLINE_SESSION(Log, TEXT("Matchmaking: we're the host.")); OnSuccessAsHost.Broadcast(); } else { OnSuccessAsClient.Broadcast(); FString ConnectString; if (PlayerControllerWeakPtr.IsValid() && SessionsInterface->GetResolvedConnectString(NAME_GameSession, ConnectString)) { UE_LOG_ONLINE_SESSION(Log, TEXT("Matchmaking as client: traveling to %s"), *ConnectString); PlayerControllerWeakPtr->ClientTravel(ConnectString, TRAVEL_Absolute); return; } } } else { UE_LOG_ONLINE(Log, TEXT("Matchmaking failed.")); OnFailure.Broadcast(); } }
From what I've investigated, the GetResolvedConnectString always seems to return "0.0.0.0:5000" no matter what and that's possibly what's tripping Unreal up, but that's just a guess.