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 Voice.

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.

Error on disconnect

2020-09-07 20:03:13

Hi, I'm making a mobile game that allows you to continue in single player mode if a multiplayer game ends prematurely. However, if internet connectivity is lost, I get an endless stream of errors from PhotonVoiceNetwork which affects performance. I'm currently solving it with:

But I'm curious if that causes issues if someone's connection flickers, or if there's a way Voice can handle this error a little more gracefully? Here's the full error:


2020-09-08 09:25:01

Hi @lmartell,

I see.
What is the disconnect cause here?

You could fix this using a proper solution not a workaround if you know why the client got disconnected in the first place.

  • If both clients PUN 2 and Photon Voice 2 disconnect then this should not happen
  • If Photon Voice 2 disconnects and PUN 2 does not (unexpected), Photon Voice 2 will keep retrying to reconnect if PhotonVoiceNetwork.Instance.AutoConnectAndJoin is true
  • If PUN 2 enters offline mode, this depends on PhotonVoiceNetwork.Instance.WorkInOfflineMode

so I would adjust values PhotonVoiceNetwork.Instance.AutoConnectAndJoin and PhotonVoiceNetwork.Instance.WorkInOfflineMode. maybe at compile time or change them on the fly at runtime.
log disconnect cause(s).
maybe have a retry attempts threshold after which you stop.

You could also explicitly try calling PhotonVoiceNetwork.Instance.Disconnect.

2020-09-08 15:41:24

I first ran across the error when my router crashed, but after that I was simulating it just by disabling my network adapter, so disconnect cause is just "Exception." If I disconnect the cable then cause is "Client Timeout" after a few seconds, which is what I'd expect. The repeating error is the same in either case.

I actually had some issues updating the voice plugin last week... I'm on 2.18 before WorkInOfflineMode was added, but started a separate thread for that and circle back once that's working.


Back to top