AutoReconnect behavior after a failed client upgrade in Photon Realtime
0 reputation · 01 Oct 2023, 07:19 UTC
0 reputation · 01 Oct 2023, 07:19 UTC
Photon Realtime’s AutoReconnect feature is designed to restore a client’s connection to the same server and room following a transient network drop. The documentation, however, does not specify what happens when the client library upgrade fails and the client disconnects due to a protocol version mismatch.
The goal is to determine whether AutoReconnect will automatically attempt to re‑enter the same room after such an upgrade failure or if the application must explicitly call JoinRoom again. Key constraints include the potential for the server to reject the reconnection attempt because the client’s protocol version no longer matches the server’s expected version, which could leave the client disconnected or in an inconsistent state.
Uncertainty remains about the sequence of ConnectionState transitions, whether the client receives any callbacks indicating a failed reconnection, and if AutoReconnect will retry or abandon the attempt after a protocol mismatch.
Specific questions to investigate:
AutoReconnect automatically try to re‑join the same room when a client upgrade fails?AutoReconnect retry or terminate the connection?28775 reputation · 01 Oct 2023, 16:18 UTC
When a client upgrade fails (for example, due to a protocol version mismatch), Photon Realtime’s AutoReconnect feature will attempt to reconnect to the same server using the last known good connection parameters. It does not automatically re‑enter the room you were in, nor does it retry the upgrade. If the server rejects the reconnection because the client’s protocol version is no longer supported, AutoReconnect stops and the client remains disconnected until the application explicitly calls JoinRoom again.
UpgradeFailed log message appears.Disconnect event.ApplicationId and GameVersion.OnConnectionFailed and OnDisconnected again, then stops retrying.JoinRoom (or OpJoinRoom) to re‑enter.OnDisconnected – always raised when the socket closes.OnConnectionFailed – carries the DisconnectCause enum; a value of DisconnectCause.ServerRejected typically signals a protocol mismatch."Failed to upgrade" followed by "Disconnect" confirm that the upgrade failure triggered the disconnect.ApplicationId and GameVersion match the values configured on the Photon Cloud dashboard. A mismatch will cause the server to reject the connection outright.client.Settings.AutoReconnectEnabled = true (or the equivalent in your language). Without this flag, the SDK will not attempt to reconnect automatically."Failed to upgrade" → "Disconnect" → "AutoReconnect started". If you see "Disconnect" without a preceding upgrade message, the problem may lie elsewhere.OnDisconnected handler, call client.OpJoinRoom (or the higher‑level JoinRoom API) to re‑enter the room after a successful reconnection.To refine the recommendation, could you confirm whether the client sends the same GameVersion during the reconnect attempt, or if it resets this value automatically after a failed upgrade?
Use comments to ask for clarification. Post a solution as an answer.
28,775 reputation · 01 Oct 2023, 13:43 UTC
The existing answer states that AutoReconnect attempts a new connection after an upgrade failure, but the SDK classifies DisconnectCause.ClientVersionMismatch (error code 32755) as a non-recoverable disconnect by default. AutoReconnect (PhotonPeer.AutoReconnect = true) only fires for causes marked recoverable—typically timeout or socket errors. A protocol/version mismatch will therefore not trigger AutoReconnect unless the server explicitly treats it as recoverable via a custom authentication response or a self-hosted plugin.
On Photon Cloud, the Allowed Client Versions list for the AppId controls which AppVersion strings the name server accepts. A failed upgrade often means the new client version hasn’t been added there, so the handshake is rejected immediately. The client must then call PhotonNetwork.ConnectUsingSettings() manually after updating its AppVersion to a permitted value.
If you implement a manual reconnect, PlayerTTL and EmptyRoomTTL still govern whether the room exists when the client arrives. Short TTLs can expire before the upgraded client reconnects, making OpRejoin fail even with a valid token.