There are some things that can cause this… Chrome (and I guess other major browsers) have memory saving options, that will prioritise the currently visible tab. For example if you go to:
You will be able to see if a tab will get “discarded” if you tab away. This normally happens when you have very low memory available.
That’s on a desktop PC, however if you experience this on a tablet, or mobile device… then you are just outta luck. Almost all mobile/tablet operating systems make drastic attempts to save memory and resources, and just about all have their own settings and ways to do this. They will also close down network connections in these attempts - If you want to build a phone in a browser for a tablet - don’t.
If this is not to do with memory optimisation, then you should look at your qualify frequency, or keep-alive settings. Firstly the qualify - make sure you are sending an OPTIONS packet to the client every 60 seconds (or 2 min etc), to keep the registration in place. If this is in place the network level keep-alive is normally not necessary. Sending a keep-alive packet (from the client) over the established TCP web-socket connection is not always necessary if you are sending data (the options packet) already. But, in some cases routers and other devises will actually close established connections if they see that no data has ben sent or received over it in a “long” time (say 10-15min).
Check the Asterisk CLI - if there is a line something like:
..."Web socket closed abruptly". Then you know that your web-socket is being pulled down by something like a tab being disposed, or a router disconnecting etc.