ILoginSession
Learn how ILoginSession changed in the upgrade.
Read time 2 minutesLast updated 2 days ago
Various functions in the VivoxVoiceChat module are replaced by the functionality in ILoginSession. For code examples and usage notes, see Sign in to a game. The following list provides the name of the function in the VivoxVoiceChat module, the comparable function in VivoxCore, and supplemental information for completing a version switch. Important: Most functions related to channel sessions in VivoxCore must be called directly from methods on an ILoginSession object reference.
-
is replaced by
Login(FPlatformUserId PlatformId, const FString& PlayerName, const FString& Credentials, const FOnVoiceChatLoginCompleteDelegate& Delegate)ILoginSession::BeginLogin(const FString& server, const FString& accessToken, FOnBeginLoginCompletedDelegate theDelegate)- Most sections of the changes that are required for BeginLogin() are covered in Sign in to a gameSign in to a game in the Vivox Unreal Developer Documentation.
- This function requires a server string that you can find in the Unity Cloud Dashboard. Set accessToken to the value that is being used for Credentials, and set the PlayerName in the AccountId for the ILoginSession that is being used.
-
is replaced by
FVivoxVoiceChat::Logout(const FOnVoiceChatLogoutCompleteDelegate& Delegate)ILoginSession::Logout()- There is no functionality for a delegate in this function in VivoxCore for Unreal, because the entire process is handled synchronously on the IClient and cannot fail. Checking the state of the ILoginSession with ILoginSession::State() after attempting a Logout() returns LoginState::LoggedOut or LoginState::LoggingOut.
-
is replaced by
FOnVoiceChatLoggedOutDelegateILoginSession.EventStateChanged -
is replaced by
FVivoxVoiceChat::IsLoggingIn(), FVivoxVoiceChat::IsLoggedIn()ILoginSession::State()- All functions relating to the LoginState of an ILoginSession are routed through the ILoginSession::State() function, which returns either LoginState::LoggedIn, LoginState::LoggingIn, LoginState::LoggingOut or LoginState::LoggedOut.
- Developers can hook into the ILoginSession.EventStateChanged event to link a function into a change in LoginState.
-
is replaced by
FOnVoiceChatLoggedInDelegateILoginSession::FOnBeginLoginCompletedDelegate, ILoginSession.EventStateChanged- VivoxCore has a delegate and an event that you can use to handle this situation. The method bound to the delegate and passed into BeginLogin() is called upon a successful attempt when the ILoginSession connects to Vivox servers.
-
is replaced by
onInvalidLoginCredentials(const VivoxClientApi::AccountName& AccountName), onLoginFailed(const VivoxClientApi::AccountName& AccountName, const VivoxClientApi::VCSStatus& Status)ILoginSession::FOnBeginLoginCompletedDelegate, ILoginSession.EventStateChanged- Unlike the VivoxVoiceChat module, VivoxCore does not distinguish failure to login due to bad credentials and other types of login errors.
- Some types of errors, such as invalid arguments, are caught immediately and are returned by BeginLogin(), in which case the delegate method never fires because it stopped before the asynchronous request could be made.
- If BeginLogin() returns VxErrorSuccess, then the bound delegate is called with any server side errors, such as invalid credentials, or another VxErrorSuccess.
-
is replaced by
GetChannelSession(const FString& ChannelName), GetChannelSession(const VivoxClientApi::Uri& ChannelUri)ILoginSession::GetChannelSession(const ChannelId \&channelId)- This function either grabs an IChannelSession that already exists or creates a new one with the ChannelId.
- To make a ChannelId, you can either use ChannelId::ChannelId(const FString& issuer, const FString& name, const FString& domain, ChannelType type, Channel3DProperties properties) to create one with the same name and the necessary properties for the channel.
- If the application is using GetChannelSession(const VivoxClientApi::Uri& ChannelUri), you can create ChannelIds by using ChannelId::CreateFromUri(const FString& uri).
-
RemoveChannelSession(const FString& ChannelName) is replaced by DeleteChannelSession(const ChannelId &channelId)
- These two functions are interchangeable, with the only requirement being turning by using the ChannelId::Name() to search the IChannelSessions list for the proper ChannelId, or casting a duplicate of the ChannelId with all of the proper values.
-
is replaced by
ClearChannelSessions()DeleteChannelSession(const ChannelId &channelId)- Replace ClearChannelSessions with a loop through IChannelSessions to grab all of the ChannelIds and to call DeleteChannelSession(const ChannelId &channelId) for each one.