check photon connection state

Hi, Photon team:
Now I check photon connection state by PhotonNetwork.connectionState.
But when I close my wifi, PhotonNetwork.connectionState is still "Connected"(this state isn't correct). This may result our app can't inform the user of disconnection.
Is there a better way to check photon connection state ???

Thank you!

Comments

  • It will timeout after several seconds but not immediately change the state.
    Did you give it up to 20 seconds?
  • Hi tobi, I give it up to 360 s.
    The PhotonNetwork.connectionState is "connected" forever even if I close the wifi.
    But there is an error: " Connect() failed: System.Net.Sockets.SocketException: Do not know the host "
    So I think photon don't update the photon connection state to disconnected when i close the wifi.

    But in the photon chat system, the OnDisconnected() can detect the disconnected state.

    Can you give me some advice to how to get the right photon connection state in photon cloud???
    Thank you!
  • Hm. I would say that's certainly a bug and the state should reset.
    It looks like your connection drops when the client is leaving the master and trying to connect to the game server. if that fails in the Connect()-call, maybe PUN is not handling the error correctly.
    I will look into things and try to fix it. I don't have this reproduced yet though, so when the next update is released, please check and give me feedback. I might need more help fixing this particular situation then.

    You can reset the state by calling disconnect usually. Then you can at least connect again. In worst case, use the status from Photon Chat as indicator for PUN, too.
    Thanks for the detailed report so far.
  • Could you log the PhotonNetwork.connectionStateDetailed in this case?
    It would help to know this one.
  • hi, Tobi:
    PhotonNetwork.connectionStateDetailed have the same problem.
    eg. if the PhotonNetwork.connectionStateDetailed is "JoinedLobby", now I close the wifi,
    the PhotonNetwork.connectionStateDetailed is "JoinedLobby" forever, the state didn't reset.
  • Sorry for asking something new, yet again:
    You close the Wifi in which way? And which device are you testing on?
  • Is there a way to decrease the timeout mentioned above(20s) ?