The Photon Forum
is Closed Permanently.

After many dedicated years of service, we have made the decision to retire our Forum and switch to read-only: we´ve saved the best to last! Your search result can be found below. Plus, we offer support via these channels:

Try Our

Please check if you can find an answer in our extensive documentation on PUN.

Join Us
on Discord

Meet and talk to our staff and the entire Photon-Community via Discord.

Stack Overflow

Find more information on Stack Overflow (for Circle members only).

Write Us
an E-Mail

Feel free to send your question directly to our developers.

check photon connection state

2014-07-21 08:52:53

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 ???


2014-07-21 10:03:58

It will timeout after several seconds but not immediately change the state. Did you give it up to 20 seconds?

2014-07-21 14:06:25

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!

2014-07-22 08:46:09

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.

2014-07-22 12:50:30

Could you log the PhotonNetwork.connectionStateDetailed in this case? It would help to know this one.

2014-07-23 08:00:36

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.

2014-07-23 09:26:44

Sorry for asking something new, yet again: You close the Wifi in which way? And which device are you testing on?

2015-11-05 03:41:17

Is there a way to decrease the timeout mentioned above(20s) ?

Back to top