How to handle network errors

There is a server and a client.
I want to display the disconnected UI when either of them is disconnected due to a network error.

I have seen many methods and tried sending Ping Pong using GameMode and sending Ping Pong using RPC, but events related to Ping Pong do not work when the server is shut down.

I’ll take a screenshot of the RPC blue print.


PingPong2
PingPong3

To be exact, I would like to print a server disconnection error when the message “LogNetPlayerMovement: Warning: Create SavedMove: Hit limit of 96 saved movements (timing out or very bad ping?)” appears on the client.
Event NetworkError is not available because the game is turned off

It doesn’t matter if it’s a C++ solution.

Thank you.

Check out GameViewportClient class, you can override these :

Afaik this is C++ only.

Thank you for your answer.
Could you give me an example code for this?
I recognized it as an interface and worked on it, but it doesn’t work as I want.
The reaction is the same when the server is closed or the client is disconnected from the Internet.

instance.h

#include "CoreMinimal.h"
#include "Engine/GameInstance.h"
#include "Engine/GameViewportClient.h"
#include "MyGameInstance.generated.h"

UCLASS()
class ASFDF_API UMyGameInstance : public UGameInstance
{
	GENERATED_BODY()
	
public:

	UFUNCTION(BlueprintNativeEvent)
		void PeekTravelFailureMessages(UWorld* InWorld, enum ETravelFailure::Type FailureType, const FString& ErrorString);
};

instance.cpp

#include "MyGameInstance.h"

void UMyGameInstance::PeekTravelFailureMessages_Implementation(UWorld* InWorld, ETravelFailure::Type FailureType, const FString& ErrorString)
{
	UE_LOG(LogTemp, Warning, TEXT("Test Network Failure PeekTravelFailureMessages"));
}