We have a website that uses sockets. Whenever users leave the webpage for another app or close the screen, it will usually disconnect the WebSocket. The error is very vague, and this seems to be a problem where Android likes to do this to conserve battery life/resources. Websites don’t have much control over this. What is the solution to fix this and the cause of this? Thanks!
I have tried on multiple devices and we have consistently been able to recreate it when we leave the app and come back to the webpage. This seems to consistently cause the Android disconnect.
Daniel Jones is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.