I want to know when my app is going to be suspend? The state of not being active for a certain amount of time or being terminated by the user. I need this because I need to close a connection a web socket. I want to keep the connection alive while the app is in the background state though.
How do I do this?
Thanks
In your AppDelegate.m file this method will be called when the user hits the home button and the app will go to the background (here you can keep your connection live, but you should read the apple documentation regarding background tasks, because your connection cannot be live forever if the app remains in the background. There are other ways to keep your app up to date like update on push notification etc):
and this method will be called when the app will get terminated (closed completely from multitasking).
You can handle your connections within this methods.