I have created a chat application. For that i have enable presence for a single channel and all user subscribe that channel. But when i close the app (Background Mode) pubnub gives me Timeout statement for that user.
But i want to show user Online until user terminate the app.
How we will manage this scenario ?
You could use Background App Refresh and make a presence heartbeat request.
Here's a simple explanation for Background App Refresh(http://www.scottyloveless.com/blog/2014/background-app-refresh-explained)
Feel free to google around for more results
You're limited to about 30 seconds to do all your work (should be enough time if you have a valid connection). You can also control the interval of the background fetch. Looks like you'll have to implement some of this yourself, but it should be doable on iOS 7 and iOS 8.