Photon does not timeout when in a room, why?

Options

We are trying to handle network errors, and when we simulate a bad network we can see that TimestampOfLastSocketReceived no longer updates.

Photon never times out however, and if we restore the network it still has no connection, but does not report any error.

Then when you actually try to send something, you get an exception in Photon instead;

Timeout-disconnect! Command: CMD(6 ch#/sq#/usq#: 0/12/0 r#/st/tt:8/60325/67361) now: 63058 challenge: 2e9375ff
UnityEngine.Debug:LogWarning (object)


Operation RaiseEvent (253) can't be sent because peer is not connected, peer state: Disconnected
UnityEngine.Debug:LogError (object)
Photon.Realtime.LoadBalancingClient:DebugReturn (ExitGames.Client.Photon.DebugLevel,string) (at Assets/Photon/PhotonRealtime/Code/LoadBalancingClient.cs:2504)
Photon.Realtime.LoadBalancingClient:CheckIfOpCanBeSent (byte,Photon.Realtime.ServerConnection,string) (at Assets/Photon/PhotonRealtime/Code/LoadBalancingClient.cs:2441)

How can we deal with this?

NOTE: When we are in the lobby, Photon correctly disconnects after ping timeout.

Answers

  • Tobias
    Options

    The timeout callback is fired when the app is active and some code calls DispatchIncomingCommands.

    Some code needs to be registered to get the callback. You can enable the SupportLogger (in PhotonServerSettings) to check if the callback is fired but your code doesn't register it.

    A timeout takes somewhat variable time. Up to 10 seconds.