[SOLVED] Keep a live websocket when app is in terminated ( kill ) state


I am using websocket with Swift 2 to maintain some data between app and server. This websocket works fine in foreground and background state, but when I terminate ( kill ) app then websocket connection breaks. When coming again to the app it will start working again.


  • All background, VOIP, and other permissions are given.
  • Generally, websocket don’t work in the background, I have figured out
    a solution to keep working in background state and when the device is
  • Tried silent push notification as well, which invokes method for
    websocket connection, silent push notification happens but the method
    works only when going back to the application.

So, any idea and suggestion appreciated about how to keep a live websocket when an app is in terminated ( kill ) state?

Thanks in advance!


It is not possible. When the user terminates the app everything goes with it, if that wasn’t the case then users would have no way to stop apps doing strange things (other than to restart the whole device).

Additionally you should not try exotic things to get around system restrictions as this will (eventually) lead to app rejection of you release to the store and / or users who are unhappy with battery life when your app is running.

Answered By – Wain

Answer Checked By – David Marino (BugsFixing Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *