I got a CustomGameMode class:
class CLIENTSERVERTEST_API AGameModePlay : public AGameMode
{
GENERATED_BODY()
public:
AGameModePlay();
virtual void PreLogin(const FString& Options, const FString& Address, const TSharedPtr<const FUniqueNetId>& UniqueId, FString& ErrorMessage);
virtual void PreLogin(const FString& Options, const FString& Address, const FUniqueNetIdRepl& UniqueId, FString& ErrorMessage);
};
What i gona do is, im searching for a option to add a user check from a database inside the “virtual void PreLogin(…);” which is overwritten from the AGameMode.
void AGameModePlay::PreLogin(const FString& Options, const FString& Address, const FUniqueNetIdRepl& UniqueId, FString& ErrorMessage)
{
FString sessionToken = ParseOption(Options, TEXT("session"));
FString account = ParseOption(Options, TEXT("account"));
UE_LOG(LogTemp, Warning, TEXT("PreLogin(2) Address='%s' sessionToken='%s' account='%s'"), *Address, *sessionToken, *account);
// some how query db and validate ip, session and account...
AGameMode::PreLogin(Options, Address, UniqueId, ErrorMessage);
}
Maybe first upfont question: With regards to client/server split, would it be save to add here just some nativ sql lib and query stuff? I mean, is this gamemode code anyhow part of client binary?
On other places like the basic login, i used e.g. VaRest to get a client authorized to the DB by Webserver, which i’m fine with. The VaRest works asynchron with using some request done event, so basically because TSharedRef HttpRequest = FHttpModule::Get().CreateRequest(); is working that way?
Then main question: Is there a way to do the request just synchron to have the response ready in the “::PreLogin(…)”?