DisconnectException
The whole answer can be found below.
Try Our
Documentation
Please check if you can find an answer in our extensive documentation on Fusion.
Join Us
on Discord
Meet and talk to our staff and the entire Photon-Community via Discord.
Read More on
Stack Overflow
Find more information on Stack Overflow (for Circle members only).
DisconnectException: None, Failed Operation with Reason: Ok
kirkokuev
2023-04-19 10:27:45
Hello, we have a problem with adding custom authentication to our project.
So we have replicated the code from Fusion BR Sample for networking operations. It works when no authentication is enabled.
Then we added custom authentication provider, that allows us to authenticate users. We have tested it and it works fine, with correct authorization it returns
{ "ResultCode": 1, "UserId": "SomeUniqueStringId" }
to Photon.
But, when we try to implement it with the client code we receive following in logs:
[5.618][1] Networking(-163860): StartGame() UserID:4cfd35a3908ee96124874aeb90be86903ff5c552_-1362147720.4 GameMode:Host DisplayName:StandaloneGame SessionName:f163436e-a820-4910-934b-b768c8b1ea07 ScenePath:Scenes/WorkspaceK/Server/HostedModeScene GameplayType:BattleRoyale MaxPlayers:200 ExtraPeers:0 CustomLobby:FusionBR.1.82
UnityEngine.Debug:Log (object)
NetworkApplication.Networking:Log (string) (at Assets/Scenes/WorkspaceK/Server/Scripts/Networking.cs:898)
NetworkApplication.Networking:StartGame (NetworkApplication.SessionRequest) (at Assets/Scenes/WorkspaceK/Server/Scripts/Networking.cs:117)
NetworkApplication.StandaloneManager:Start () (at Assets/Scenes/WorkspaceK/Server/Scripts/StandaloneManager.cs:100)
[5.660][1] Networking(-163860): Starting ConnectPeerCoroutine() - Starting - Peer 0
UnityEngine.Debug:Log (object)
NetworkApplication.Networking:Log (string) (at Assets/Scenes/WorkspaceK/Server/Scripts/Networking.cs:898)
NetworkApplication.Networking:UpdateCurrentSession () (at Assets/Scenes/WorkspaceK/Server/Scripts/Networking.cs:226)
NetworkApplication.Networking:Update () (at Assets/Scenes/WorkspaceK/Server/Scripts/Networking.cs:170)
Starting Host#0 ...
UnityEngine.Debug:LogWarning (object)
NetworkApplication.Networking/<ConnectPeerCoroutine>d__37:MoveNext () (at Assets/Scenes/WorkspaceK/Server/Scripts/Networking.cs:294)
UnityEngine.MonoBehaviour:StartCoroutine (System.Collections.IEnumerator)
NetworkApplication.Networking:UpdateCurrentSession () (at Assets/Scenes/WorkspaceK/Server/Scripts/Networking.cs:227)
NetworkApplication.Networking:Update () (at Assets/Scenes/WorkspaceK/Server/Scripts/Networking.cs:170)
[5.678][2] Networking(-163860): NetworkRunner.StartGame()
UnityEngine.Debug:Log (object)
NetworkApplication.Networking:Log (string) (at Assets/Scenes/WorkspaceK/Server/Scripts/Networking.cs:898)
NetworkApplication.Networking/<ConnectPeerCoroutine>d__37:MoveNext () (at Assets/Scenes/WorkspaceK/Server/Scripts/Networking.cs:344)
UnityEngine.SetupCoroutine:InvokeMoveNext (System.Collections.IEnumerator,intptr)
<color=#73ACE5>[Fusion]</color> Fusion.Photon.Realtime.Async.DisconnectException
<i>See next error log entry for details.</i>
UnityEngine.Debug:LogError (object,UnityEngine.Object)
Fusion.FusionUnityLogger:Log<Fusion.Log/DefaultContext> (Fusion.LogType,string,Fusion.Log/DefaultContext&,string) (at Assets/Photon/Fusion/Scripts/FusionUnityLogger.cs:127)
Fusion.FusionUnityLogger:LogException<Fusion.Log/DefaultContext> (string,Fusion.Log/DefaultContext&,System.Exception) (at Assets/Photon/Fusion/Scripts/FusionUnityLogger.cs:139)
Fusion.Log:Exception<Fusion.NetworkRunner> (Fusion.NetworkRunner,System.Exception)
Fusion.NetworkRunner/<ShutdownWithException>d__314:MoveNext ()
System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<Fusion.StartGameException>:Start<Fusion.NetworkRunner/<ShutdownWithException>d__314> (Fusion.NetworkRunner/<ShutdownWithException>d__314&)
Fusion.NetworkRunner:ShutdownWithException (System.Exception)
Fusion.NetworkRunner/<StartGameModeCloud>d__313:MoveNext ()
System.Runtime.CompilerServices.AsyncTaskMethodBuilder:SetException (System.Exception)
Fusion.NetworkRunner/<ConnectToCloud>d__310:MoveNext ()
System.Runtime.CompilerServices.AsyncTaskMethodBuilder:SetException (System.Exception)
Fusion.CloudServices/<ConnectToCloud>d__55:MoveNext ()
System.Threading.Tasks.TaskCompletionSource`1<int16>:TrySetException (System.Exception)
Fusion.Photon.Realtime.Async.OperationHandler:SetException (System.Exception)
Fusion.Photon.Realtime.Async.OperationHandler:OnDisconnected (Fusion.Photon.Realtime.DisconnectCause)
Fusion.Photon.Realtime.ConnectionCallbacksContainer:OnDisconnected (Fusion.Photon.Realtime.DisconnectCause)
Fusion.Photon.Realtime.LoadBalancingClient:OnStatusChanged (ExitGames.Client.Photon.StatusCode)
ExitGames.Client.Photon.PeerBase/<>c__DisplayClass109_0:<EnqueueStatusCallback>b__0 ()
ExitGames.Client.Photon.EnetPeer:DispatchIncomingCommands ()
ExitGames.Client.Photon.PhotonPeer:DispatchIncomingCommands ()
ExitGames.Client.Photon.PhotonPeer:Service ()
Fusion.Photon.Realtime.LoadBalancingClient:Service ()
Fusion.Photon.Realtime.FusionRelayClient:Update ()
Fusion.CloudCommunicator:Service ()
Fusion.CloudServices:Update ()
Fusion.NetworkRunner:Update ()
DisconnectException: None
Fusion.CloudServices.ConnectToCloud (Fusion.Photon.Realtime.AuthenticationValues authentication, Fusion.Photon.Realtime.AppSettings customAppSettings) (at <b6b15a87f1474ba9b6a19a00558a1f6f>:0)
Fusion.NetworkRunner.ConnectToCloud (Fusion.Photon.Realtime.AuthenticationValues authentication, Fusion.Photon.Realtime.AppSettings customAppSettings, Fusion.CloudCommunicator externalCommunicator) (at <b6b15a87f1474ba9b6a19a00558a1f6f>:0)
Fusion.NetworkRunner.StartGameModeCloud (Fusion.StartGameArgs args) (at <b6b15a87f1474ba9b6a19a00558a1f6f>:0)
UnityEngine.Debug:LogException(Exception)
Fusion.FusionUnityLogger:LogException(String, DefaultContext&, Exception) (at Assets/Photon/Fusion/Scripts/FusionUnityLogger.cs:143)
Fusion.Log:Exception(NetworkRunner, Exception)
Fusion.<ShutdownWithException>d__314:MoveNext()
System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1:Start(<ShutdownWithException>d__314&)
Fusion.NetworkRunner:ShutdownWithException(Exception)
Fusion.<StartGameModeCloud>d__313:MoveNext()
System.Runtime.CompilerServices.AsyncTaskMethodBuilder:SetException(Exception)
Fusion.<ConnectToCloud>d__310:MoveNext()
System.Runtime.CompilerServices.AsyncTaskMethodBuilder:SetException(Exception)
Fusion.<ConnectToCloud>d__55:MoveNext()
System.Threading.Tasks.TaskCompletionSource`1:TrySetException(Exception)
Fusion.Photon.Realtime.Async.OperationHandler:SetException(Exception)
Fusion.Photon.Realtime.Async.OperationHandler:OnDisconnected(DisconnectCause)
Fusion.Photon.Realtime.ConnectionCallbacksContainer:OnDisconnected(DisconnectCause)
Fusion.Photon.Realtime.LoadBalancingClient:OnStatusChanged(StatusCode)
ExitGames.Client.Photon.<>c__DisplayClass109_0:<EnqueueStatusCallback>b__0()
ExitGames.Client.Photon.EnetPeer:DispatchIncomingCommands()
ExitGames.Client.Photon.PhotonPeer:DispatchIncomingCommands()
ExitGames.Client.Photon.PhotonPeer:Service()
Fusion.Photon.Realtime.LoadBalancingClient:Service()
Fusion.Photon.Realtime.FusionRelayClient:Update()
Fusion.CloudCommunicator:Service()
Fusion.CloudServices:Update()
Fusion.NetworkRunner:Update()
<color=#73ACE5>[Fusion]</color> Failed Operation with Reason: Ok
UnityEngine.Debug:LogError (object,UnityEngine.Object)
Fusion.FusionUnityLogger:Log<Fusion.NetworkRunner> (Fusion.LogType,string,Fusion.NetworkRunner&,string) (at Assets/Photon/Fusion/Scripts/FusionUnityLogger.cs:127)
Fusion.Log:Error<Fusion.NetworkRunner> (Fusion.NetworkRunner,object)
Fusion.NetworkRunner/<ShutdownWithException>d__314:MoveNext ()
System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<Fusion.StartGameException>:Start<Fusion.NetworkRunner/<ShutdownWithException>d__314> (Fusion.NetworkRunner/<ShutdownWithException>d__314&)
Fusion.NetworkRunner:ShutdownWithException (System.Exception)
Fusion.NetworkRunner/<StartGameModeCloud>d__313:MoveNext ()
System.Runtime.CompilerServices.AsyncTaskMethodBuilder:SetException (System.Exception)
Fusion.NetworkRunner/<ConnectToCloud>d__310:MoveNext ()
System.Runtime.CompilerServices.AsyncTaskMethodBuilder:SetException (System.Exception)
Fusion.CloudServices/<ConnectToCloud>d__55:MoveNext ()
System.Threading.Tasks.TaskCompletionSource`1<int16>:TrySetException (System.Exception)
Fusion.Photon.Realtime.Async.OperationHandler:SetException (System.Exception)
Fusion.Photon.Realtime.Async.OperationHandler:OnDisconnected (Fusion.Photon.Realtime.DisconnectCause)
Fusion.Photon.Realtime.ConnectionCallbacksContainer:OnDisconnected (Fusion.Photon.Realtime.DisconnectCause)
Fusion.Photon.Realtime.LoadBalancingClient:OnStatusChanged (ExitGames.Client.Photon.StatusCode)
ExitGames.Client.Photon.PeerBase/<>c__DisplayClass109_0:<EnqueueStatusCallback>b__0 ()
ExitGames.Client.Photon.EnetPeer:DispatchIncomingCommands ()
ExitGames.Client.Photon.PhotonPeer:DispatchIncomingCommands ()
ExitGames.Client.Photon.PhotonPeer:Service ()
Fusion.Photon.Realtime.LoadBalancingClient:Service ()
Fusion.Photon.Realtime.FusionRelayClient:Update ()
Fusion.CloudCommunicator:Service ()
Fusion.CloudServices:Update ()
Fusion.NetworkRunner:Update ()
[10.784][223] Networking(-163860): StartGame() Result: [StartGameResult: Ok:True, ShutdownReason: Ok] - Peer 0
UnityEngine.Debug:Log (object)
NetworkApplication.Networking:Log (string) (at Assets/Scenes/WorkspaceK/Server/Scripts/Networking.cs:898)
NetworkApplication.Networking/<ConnectPeerCoroutine>d__37:MoveNext () (at Assets/Scenes/WorkspaceK/Server/Scripts/Networking.cs:379)
UnityEngine.SetupCoroutine:InvokeMoveNext (System.Collections.IEnumerator,intptr)
[10.784][223] Networking(-163860): Waiting for connection - Peer 0
UnityEngine.Debug:Log (object)
NetworkApplication.Networking:Log (string) (at Assets/Scenes/WorkspaceK/Server/Scripts/Networking.cs:898)
NetworkApplication.Networking/<ConnectPeerCoroutine>d__37:MoveNext () (at Assets/Scenes/WorkspaceK/Server/Scripts/Networking.cs:409)
UnityEngine.SetupCoroutine:InvokeMoveNext (System.Collections.IEnumerator,intptr)
[2023-01-31T18:56:53] [WARNING] [FusionVoiceClient] [RunnerServer(Clone)] Unexpected: fusion region is empty.
UnityEngine.Debug:LogWarningFormat (UnityEngine.Object,string,object[])
Photon.Voice.Unity.UnityLogger:Log (ExitGames.Client.Photon.DebugLevel,UnityEngine.Object,string,string,string,object[]) (at Assets/Photon/PhotonVoice/Code/VoiceLogger.cs:104)
Photon.Voice.Unity.VoiceComponentImpl/LoggerImpl:Log (ExitGames.Client.Photon.DebugLevel,string,object[]) (at Assets/Photon/PhotonVoice/Code/VoiceComponent.cs:72)
Photon.Voice.Unity.VoiceComponentImpl/LoggerImpl:LogWarning (string,object[]) (at Assets/Photon/PhotonVoice/Code/VoiceComponent.cs:88)
Photon.Voice.Fusion.FusionVoiceClient:VoiceConnectAndFollowFusion () (at Assets/Photon/PhotonVoice/Code/Fusion/FusionVoiceClient.cs:188)
Photon.Voice.Fusion.FusionVoiceClient:VoiceConnectOrJoinRoom () (at Assets/Photon/PhotonVoice/Code/Fusion/FusionVoiceClient.cs:136)
Photon.Voice.Fusion.FusionVoiceClient:OnVoiceClientStateChanged (Photon.Realtime.ClientState,Photon.Realtime.ClientState) (at Assets/Photon/PhotonVoice/Code/Fusion/FusionVoiceClient.cs:92)
Photon.Realtime.LoadBalancingClient:set_State (Photon.Realtime.ClientState) (at Assets/Photon/PhotonRealtime/Code/LoadBalancingClient.cs:456)
Photon.Realtime.LoadBalancingClient:OnStatusChanged (ExitGames.Client.Photon.StatusCode) (at Assets/Photon/PhotonRealtime/Code/LoadBalancingClient.cs:3080)
ExitGames.Client.Photon.EnetPeer:StopConnection ()
ExitGames.Client.Photon.PhotonPeer:StopThread ()
Photon.Voice.Unity.VoiceConnection:OnDestroy () (at Assets/Photon/PhotonVoice/Code/UnityVoiceClient.cs:353)
Photon.Voice.Fusion.FusionVoiceClient:OnDestroy () (at Assets/Photon/PhotonVoice/Code/Fusion/FusionVoiceClient.cs:86)
And the player is never instantiated.
I have also tried to put this code in the clean Fusion BR project and it also breaks the connection. Without authentication everything works perfectly.
I am doing authentication like this on the client
// Authentication with photon
AuthenticationValues authentication = new AuthenticationValues();
authentication.AuthType = CustomAuthenticationType.Custom;
authentication.AddAuthParameter("pass", "testpass1");
authentication.AddAuthParameter("user", "[email protected]");
StartGameArgs startGameArgs = new StartGameArgs();
startGameArgs.GameMode = peer.GameMode;
startGameArgs.SessionName = peer.Request.SessionName;
startGameArgs.Scene = peer.Scene;
startGameArgs.Initialized = OnGamePeerInitialized;
startGameArgs.ObjectPool = pool;
startGameArgs.CustomLobbyName = peer.Request.CustomLobby;
startGameArgs.SceneManager = peer.SceneManager;
startGameArgs.DisableClientSessionCreation = true;
startGameArgs.AuthValues = authentication;
var startGameTask = runner.StartGame(startGameArgs);
I don't understand what is "DisconnectException: None" and "Failed Operation with Reason: Ok".
Please advise?
Thanks!