Unable to keep Websocket alive in background iOS

I am creating a VOIP application and also using a SocketRocket library to manage my Websockets and pull data from it. But my main problem is when I click on (IOS) Home button so my websocket disconnects after one minute. I have read Apple's documentation for developing VOIP application from the link below

https://developer.apple.com/library/ios/#documentation/iPhone/Conceptual/iPhoneO SProgrammingGuide/AdvancedAppTricks/AdvancedAppTricks.html

I am also setting UIBackgroundModes in plist for VOIP and Audio, but when I resume my application so my websocket state is closed although I am not releasing websocket Object.

_webSocket.readyState =3    //  It identifies that my websocket is close.

Now for restablishing a connection with Websocket so I need to call again websocket open and create another instance of Websocket object after releasing previously.

On closing of websocket my SIP registeration from my server also disconnects and I need to reconnect to my SIP again.

How can I prevent my websocket to get close and how can I make setKeepAliveTimeout:handler: useful to fix my problem.

Library use to establish Websocket is as below

https://github.com/square/SocketRocket

Xcode-OTHER, iOS 6.1

Posted on Jun 4, 2013 12:47 AM

Reply

There are no replies.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Unable to keep Websocket alive in background iOS

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.