Chat Disconnect after watching video ad

On both iOS and Android, if I watch an ad the Chat client disconnects. This post gave me the idea to look for a chat chatClient.chatPeer.DisconnectTimeout but increasing this does not fix the problem.

So, is there an easy solution for this?

I did some testing and Chat does not disconnect using PUN multiplayer during an ad. Multiplayer doesn't disconnect either when ads appear. I tested this on Android and iOS as the same time and neither disconnected. However, if I am in an PUN offline mode single player game then chat will disconnect when I watch an ad.

I want players in single player mode to be able to chat globally.

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi @Teddymac,

    PUN and Photon Chat use two separate clients and two separate connections so we should make a difference between the two.

    Let's not consider PUN here and try to describe the behaviour you are noticing for Photon Chat only.
    Photon Chat does not have an offline mode also.
  • Ok. When ever an ad shows using Google AdMob on Android or Unity Ads on iOS and the ad shows for more than 10 sec Photo Chat disconnects.

    I can duplicate this in the Unity Editor while the game is running by hitting pause for more than 10 secs.

    I've tried increasing the timeout with chatClient.chatPeer.DisconnectTimeout but that doesn't seem to have an affect.

    That is the issue in its simplest form.
  • JohnTube
    JohnTube ✭✭✭✭✭
    This is the expected behaviour currently.
    When a video is being played the app moves to the background and the chat client stops communicating with the server.

    In future SDKs Photon Chat for Unity may be able to keep connection alive when the app is paused or in background for Android for a limited time like it is the case now for PUN. But no ETA.
    Currently you could disconnect and reconnect in OnApplicationPause.
  • Ok, yeah, I've done implemented such a work around. Thanks for the conformation.

    It is, however, very strange that ads do not disconnect Chat while in PUN multiplayer. I use the same code set for multiplayer and single player and until just recently there was no code to automatically reconnect. Photon is set to "run in background" in the Photon settings, I wonder if that somehow affects it. But, anyway, this isn't a problem but rather a benefit. Still it is odd.