Documentation Index
Fetch the complete documentation index at: https://mintlify.com/kenzz55/ue5-iocp-mmo-server/llms.txt
Use this file to discover all available pages before exploring further.
UAuthClientSubsystem is a UGameInstanceSubsystem that owns every interaction with the ASP.NET Core AuthServer. It is responsible for registering and authenticating accounts, fetching the list of available game servers, selecting a server to play on, and storing the resulting tokens and connection details that UGameClientSubsystem needs to open a TCP game connection. No IOCP GameServer communication is performed by this class — that boundary is enforced by design.
Class declaration
AuthServerBaseUrl is http://127.0.0.1:5000. Change it at runtime with SetAuthServerBaseUrl before making any requests, or configure it via EditAnywhere in the Blueprint defaults.
HTTP request internals
All requests are made through Unreal’sFHttpModule. JSON POST requests are sent via the private helper SendJsonRequest, and GET requests via SendGetRequest. Both helpers:
- Build the full URL by concatenating
AuthServerBaseUrland a route string (e.g./auth/login). - Create a request via
FHttpModule::Get().CreateRequest(). - Set
Accept: application/jsonandContent-Type: application/json. - Attach a completion delegate that is invoked on the game thread when the response arrives.
- Call
ProcessRequest()and return its success flag.
ProcessRequest() returns false, the corresponding OnXxxResult delegate is broadcast immediately with bSuccess = false.
Methods
Register
Creates a new player account on the AuthServer.
The player’s account identifier (typically an email address).
The desired account password.
The in-game display name for the new account.
success (bool) and message (string). The result is broadcast on OnRegisterResult(bSuccess, Message). Registration does not store an access token — a separate login call is required.
Login
Authenticates an existing account and stores the returned accessToken.
The registered account identifier.
The account password.
accessToken field is extracted from the JSON response and stored in the private AccessToken member. On failure, AccessToken, EnterToken, SelectedGameServerIp, and SelectedGameServerPort are all cleared. The result is broadcast on OnLoginResult(bSuccess, Message).
RequestServerList
Fetches the list of available game servers. No authentication header is required — the server list is publicly accessible.
HTTP request:
FAuthServerInfo struct:
CachedServerList and broadcast on OnServerListResult(bSuccess, Servers). If parsing fails, CachedServerList is left empty.
SelectServer
Exchanges the stored AccessToken and a ServerId for a short-lived EnterToken, plus the game server IP and port.
The
ServerId of the server to connect to, as returned by RequestServerList.AccessToken must be non-empty (i.e. Login must have succeeded). If it is empty, OnSelectServerResult is broadcast immediately with bSuccess = false and the message "login required".
HTTP request:
| JSON field | Stored in |
|---|---|
gameServerIp | SelectedGameServerIp |
gameServerPort | SelectedGameServerPort |
enterToken | EnterToken |
characterId | SelectedCharacterId |
OnSelectServerResult(bSuccess, GameServerIp, GameServerPort, EnterToken, CharacterId, Message).
SelectDefaultServer
Convenience wrapper that calls SelectServer with the first non-maintenance server from CachedServerList. If CachedServerList is empty or all servers are in maintenance, it broadcasts OnSelectServerResult with bSuccess = false and "no available server".
ClearLocalSession
Resets all stored session state: AccessToken, EnterToken, SelectedGameServerIp, SelectedGameServerPort, SelectedCharacterId, and CachedServerList. Call this on logout or when returning to the login screen.
Stored state
After a successfulLogin → RequestServerList → SelectServer sequence, the following accessors return valid values:
| Accessor | Type | Description |
|---|---|---|
GetAccessToken() | FString | JWT used to authenticate subsequent AuthServer requests |
GetEnterToken() | FString | Short-lived token passed to GameClientSubsystem::ConnectAndEnterGame |
GetSelectedGameServerIp() | FString | IP address of the chosen game server |
GetSelectedGameServerPort() | int32 | TCP port of the chosen game server |
GetSelectedCharacterId() | int64 | Character ID associated with the selected server slot |
GetCachedServerList() | TArray<FAuthServerInfo> | All servers returned by the last RequestServerList call |
IsLoggedIn() | bool | Returns true when AccessToken is non-empty |