UNET disconnects on any loss of focus (even IAP, status bar..etc)

Hi all, for some reason, my Unity UNET client disconnects at the hint of any loss of focus for the app (in iOS or Android). I can understand this happening if a player hits the home button and stays out of the game for like 10 seconds. This problem didn’t exist when I was using legacy unity networking, it started when I migrated to UNET.

For example, my client gets disconnected (says due to timeout) during any loss of focus, even for a second. So if a game is going on and a player is doing an in-app purchase to top up his coins, it disconnects. Or even if pulling up the status bar to change the brightness the client disconnects right away… as soon as the app loses focus.

I’m using Unity 5.6.1f1 and here’s my server config:

        var config = new ConnectionConfig();
        config.AddChannel(QosType.ReliableSequenced); // control channel (2) (game interactions)
        config.MinUpdateTimeout = 100;
        config.PingTimeout = 500;
        config.DisconnectTimeout = 5000;

I’m NOT using NetworkManager (too much for what I’m doing, it’s a turn based card game). Instead, I’ve implemented NetworkServer right in script.

Any assistance is helpful! I don’t think handling disconnects/reconnects is a viable solution, It’s unreasonable to ask a developer to handle any loss of focus with a disconnect/reconnect when UNET was supposed to be an out-of-the-box solution.

Thanks for the assistance

I’m just so upset at @Unity! Having to rewrite so much of my code that relied on NetworkConnections!!! Losing valuable time and for what?!!??!!
I find that Unity really botched the new Networking code! To completely disconnect just because player is doing an IAP or changing brightness is ludicrous!