Disconnecting from timeout stops reconnects from working.

I have been running into an issue on iOS where the user is connected to photon, suspends the application, waits more than 10-15 seconds and reopens the application. After doing this Photon appears to send the message "StatusCode.DisconnectByServer" and the NetworkingPeer sends the message "PhotonNetworkingMessage.OnFailedToConnectToPhoton". However once the user is disconnected in this way they are never able to reconnect to PhotonNetwork shows connected = true, but connectionStateDetailed as PeerCreated. This appears to be a bug in PhotonPeer in Photon3Unity3D.dll and changing how status messages are handled in NetworkingPeer does not solve the issue.

Comments

  • More on this. Apparently you can do PhotonNetwork.Disconnect() after receiving the OnFailedToConnectToPhoton message when disconnected after timing out, then wait for connectionStateDetailed to change to PeerCreated, then call PhotonNetwork.Connect to get reconnect to the server, but this still seems like an odd way of handling timeouts to the server. I would expect that you would get the callback OnDisconnectedFromPhoton after a timeout has happened and OnFailedToConnectToPhoton would only be called if a failure to connect happens during the connecting process and not after a successful connection has been established already.
  • We will check the state of PhotonNetwork. We weren't aware this gets out of sync with the detailed state.
    You are right about OnDisconnectedFromPhoton. It should not be called when we were connected. It should only be used when we fail to connect.

    Both should be fixed in the next PUN update. Likely next week or so.
    Thanks for pointing us to it.
Sign In or Register to comment.