Unable to reconnect to room

Hello,

I have an application that uses Photon Realtime version 3 in Unity version 2018.2.12f1 on WebGL and I require help with the following scenario -

1. Two users connect to a room and play.
2. User A loses internet connection.
3. User A regains internet connection and tries to rejoin the room.
4. User A is unable to rejoin the room and instead just jumps between several states including "Authenticating" and "ConnectedTpMasterServer" and "ConnectingToMasterServer".

Inside the Unity editor, if I use the regular "OpJoinOrCreateRoom" function, user A is able to reconnect to the room with no problem, but this does not happen in the build.
Using "OpReJoinRoom" fails both in the editor and in the build.

Please assist.

Comments

  • Additional information:

    When using the "OpJoinOrCreateRoom" function to return to the game (in WebGL), the client state switches to "joining" but then goes back to "joinedLobby". My code states that when the state reaches "joinedLobby" it should try and join the room again, but on that second time, I recieve an error that I can't do that because the current state is not longer "joinedLobby" but is instead "joining".
    The game then just hangs on "joining" and doesn't proceed further.
  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi @GamingReborn,

    Photon Realtime version 3
    Could you verify the version please? For Photon Realtime client SDKs it should be the one in the SDK zip file.

    In step 2 how do you detect connection loss?
    In step 3 how do you detect that the internet is back?
    In step 3 how do you try to rejoin?

    Does this happen sometimes or most of the time or every time?

    Could you try to reproduce on any of the following regions: "CAE", "AU" or "KR" instead of "EU"?
    Did you try setting .NET version to 4.x?
  • Seems the issue is resolved now. "OpReJoinRoom" gets the player back into the room correctly.
    I am not quite sure what I changed to get this to work.

    I am keeping an eye on this, since this wasn't acting in the most stable way.
  • Turns out that even though the game always reconnects properly on all of my devices, it sometimes doesn't work for my clients.
    They describe that upon reconnecting the Internet, the game does not reconnect properly.

    In the logs I can see that Photon attempts an Authentication and then falls back to being "Disconnected".

    To answer your questions:

    1. We are using a "EU" server.
    2. I have tried using .NET 4.x as well as 3.5. There is no difference in the result.
    3. I detect connection loss using your API.
    4. I detect that the internet is back by attempting to reconnect every 10 seconds.
    5. I reconnect the same way I connect in the first place, except I am using "OpReJoinRoom" instead of "OpJoinOrCreateRoom"

    Please assist.
  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi @GamingReborn,

    What Photon SDK and version are you using?

    4. I detect that the internet is back by attempting to reconnect every 10 seconds.
    Are you sure connection is really back? how are you detecting this?
    In the logs I can see that Photon attempts an Authentication and then falls back to being "Disconnected".

    Could you share the Photon logs?
    What error do you see?
    What is the disconnection cause?
  • 1. I am using Photon3Unity3D.
    2. The user claims they can browse the internet freely after reconnecting.
    3. I don't see any errors. The logs I am printing can be seen in the videos below.

    Here are a few videos the client shared with me. Most of the red text shows when Photon detects that its state has changed.

    https://www.dropbox.com/s/9s1yrsm92g2zd5y/סרטון מס 1.mp4?dl=0
    https://www.dropbox.com/s/r6q4saeffs1pnuu/סרטון מס 2.mp4?dl=0
    https://www.dropbox.com/s/xiwktu9amm8qhsb/סרטון מס 3.mp4?dl=0

    As you can see, sometimes the game reconnects properly and sometimes it doesn't.
  • 5. The disconnection cause is a manual disconnection of the internet cable. This is done for testing, to make sure the game can recover from an accidental disconnection.
  • Any idea how this can be fixed?
  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi @GamingReborn,

    Thank you and your client for taking the time to record those videos.
    Unfortunately, I could not extract much info from it.

    It looks like you are using Photon Realtime Unity SDK but you did not provide the version of the SDK which can be found in the readme or in the package zip file name.

    When the client disconnects you can get the disconnect cause from the callback or from the LoadBalancingClient. This depends on which version you are using. We need to know the disconnect cause, is it client timeout, server timeout or something else.

    In the LoadBalancingClient version you have is there a ReconnectAndRejoin method or Reconnect method? or only OpRejoinRoom?

    If the Photon Realtime Unity SDK is old, we recommend you get the most up to date one from PUN2 package, you could remove "Assets/Photon/PhotonUnityNetworking" and "Assets/Photon/PhotonChat" folders and keep only "Assets/Photon/PhotonLibs" and "Assets/Photon/PhotonRealtime".
  • Hi @JohnTube ,

    I asked the client to make some screenshots with a new version I've created which should post the connection reason as well.

    There is no "ReconnectAndRejoin" method. Only something called "DisconnectToReconnect".

    I am not sure what version this is. It was sent to me by the client. They told me they are using it for all of their projects.
    I do know they are unfortunately unwilling to use PUN.
  • @JohnTube ,

    I figured some more information.

    The disconnection reason is "Exception - Some internal exception caused the socket code to fail. Contact Exit Games".

    I now know how to recreate the bug on my device as well. While using a PC connected with an Ethernet cable, I take out the cable. If I put it back in around the moment the Photon client figures out it was disconnected (it usually takes it a few seconds with an Ethernet cable. For some reason, when using WiFi it knows about the disconnection immediately), the bug happens.

    I thought that maybe sharing my code will help, so here it is.
    This is my MultiplayerManager - https://codeshare.io/2KDbrE
    And this is my override of LoadBalancingClient - https://codeshare.io/G88oyD

    I learn about the disconnection in MultiplayerManager line 166 (in the function "StateChanged"). The rest of the flow should be easy to follow from there.

    Thank you very much.