service - websocket connection keeps disconnecting [Android] -


my app makes websocket connection url using this library. working fine. app communication app (sends , receives messages). when app goes background (pressing home key) websocket connection still works , user receives push notifications new messages.

the problem that, when app in background, after amount of time, websocket connection disconnects automatically. time interval different each time (sometimes 5 seconds, 5 minutes).

now problem not url (no idle time/timeout issues - believe me, works fine on other platforms). looking possible reasons behaviour can fix problem.

how websocket connection disconnected when app goes in background. also, should run continuous background service remedy?

ps: there no service in app right now. library supposed let websocket connection running when app goes background.

the issue library using not stop connection when app backgrounded... however, android may kill process.

a service exists prevent problem. if implement in service should solve problem.

a word of caution: because can not mean should this. careful memory , battery usage when implement service. intended run in background indefinitely - , can make users unhappy if have cpu/battery intensive code, or android may kill service if consumes memory.


Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -