DISCONNECT
DISCONNECT
#Overview
name: DISCONNECT
This variable is created as a Console Variable (cvar).
- type:
Exec
- help:
Sorry: Exec commands have no help
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of DISCONNECT is to handle the disconnection process in various network-related subsystems of Unreal Engine 5. It is primarily used for managing network connections, including online beacons, voice chat, and general game instance networking.
This setting variable is relied upon by several Unreal Engine subsystems, plugins, and modules:
- Online Subsystem Utils plugin
- EOS Voice Chat plugin
- Engine’s GameInstance module
- Engine’s core networking functionality
The value of this variable is not set directly, but rather it is used as a command identifier in various parts of the engine to trigger disconnection processes.
DISCONNECT interacts with other networking-related commands and functions, such as RECONNECT, which is often found in the same context.
Developers must be aware that DISCONNECT is a command rather than a typical setting variable. It is used in command parsing scenarios to initiate disconnection procedures in different contexts.
Best practices when using this command include:
- Ensure proper error handling and logging when disconnecting.
- Implement appropriate user feedback when a disconnect occurs.
- Consider the different contexts where DISCONNECT might be used (e.g., voice chat, game instance, online beacons) and handle each appropriately.
- Always pair DISCONNECT functionality with corresponding reconnection or cleanup procedures to maintain a robust networking system.
- Use the command in conjunction with other networking commands and functions to create a comprehensive network management system.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystemUtils/Source/OnlineSubsystemUtils/Private/OnlineSubsystemUtils.cpp:578
Scope (from outer to inner):
file
function bool HandleBeaconCommands
Source code excerpt:
}
}
else if (FParse::Command(&Cmd, TEXT("DISCONNECT")))
{
FOnlineBeaconClientFilter BeaconFilter;
if (FOnlineBeaconClientFilter::Parse(Cmd, BeaconFilter, FOnlineBeaconClientFilterFlags::None))
{
UE_LOG(LogBeacon, Log, TEXT("Disconnecting beacons based on filter: %s."), *BeaconFilter.ToString());
#Loc: <Workspace>/Engine/Plugins/Online/VoiceChat/EOSVoiceChat/Source/EOSVoiceChat/Private/EOSVoiceChat.cpp:939
Scope: file
Source code excerpt:
return true;
}
else if (FParse::Command(&Cmd, TEXT("DISCONNECT")))
{
Disconnect(FOnVoiceChatDisconnectCompleteDelegate::CreateLambda([](const FVoiceChatResult& Result)
{
UE_LOG(LogEOSVoiceChat, Display, TEXT("EOS DISCONNECT result:%s"), *LexToString(Result));
}));
return true;
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/GameInstance.cpp:777
Scope (from outer to inner):
file
function bool UGameInstance::Exec
Source code excerpt:
return HandleOpenCommand(Cmd, Ar, InWorld);
}
else if (FParse::Command(&Cmd, TEXT("DISCONNECT")))
{
return HandleDisconnectCommand(Cmd, Ar, InWorld);
}
else if (FParse::Command(&Cmd, TEXT("RECONNECT")))
{
return HandleReconnectCommand(Cmd, Ar, InWorld);
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/UnrealEngine.cpp:4897
Scope (from outer to inner):
file
function bool UEngine::Exec
Source code excerpt:
}
#endif // WITH_SERVER_CODE
else if( FParse::Command( &Cmd, TEXT("DISCONNECT")) )
{
return HandleDisconnectCommand( Cmd, Ar, InWorld );
}
else if( FParse::Command( &Cmd, TEXT("RECONNECT")) )
{
return HandleReconnectCommand( Cmd, Ar, InWorld );