AutoReconnect behavior after a failed client upgrade in Photon Realtime
26.5K reputation · 01 Oct 2023, 07:19 UTC
AutoReconnect behavior after a failed client upgrade
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:
- Does
AutoReconnectautomatically try to re‑join the same room when a client upgrade fails? - If the server rejects the reconnection due to a protocol version mismatch, does
AutoReconnectretry or terminate the connection? - What callbacks or connection state changes are triggered during this scenario, and how can an application detect a failed reconnection attempt?
1 answer
1 question comment
Use comments to ask for clarification. Post a solution as an answer.
26,525 reputation · 01 Oct 2023, 13:43 UTC
Recoverable vs. non-recoverable disconnect causes
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.
Dashboard configuration matters
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.
Rejoin window
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.