D
D
Dima Yarmolchuk2012-10-17 22:37:49
Objective-C
Dima Yarmolchuk, 2012-10-17 22:37:49

WebSocket running in application background?

Good day.
Is it possible to create a WebSocket for communication between the client and the server that will not break when the application goes into the background, that is, the user presses the "home" button on his iphone?
I am aware that there are 5 types of apps that are allowed to run unrestricted in the Background in iOS 5:
Apps that play audio while in the Background. A good example is the same Instacast that plays a podcast.
Apps that mark your location in the Background. For example, you need voice reminders from TomTom navigation even if another app is Active.
Applications that "listen" for incoming calls via VoIP. If you are using Skype on iOS, you may receive an incoming Skype call when the app is in the Background state.
Nesstand apps that download new content.
Applications that receive continuous updates from external accessories while in the Background state.

My app is a chat client that can chat, I need to be able to send messages when the app is in the background.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
D
Dima Yarmolchuk, 2012-10-22
@yarmolchuk

maybe it will come in handy for someone, I found a way out of situations through a third-party framework github.com/ndcube/WebSocket-for-Objective-C only when creating a socket
CFStreamCreatePairWithSocketToHost(NULL, ( CFStringRef)hostURL.host, port, &readStream, &writeStream); CFReadStreamSetProperty(readStream, kCFStreamNetworkServiceType, kCFStreamNetworkServiceTypeVoIP); CFWriteStreamSetProperty(writeStream, kCFStreamNetworkServiceType, kCFStreamNetworkServiceTypeVoIP); inputStream = ( NSInputStream *)readStream; outputStream = ( NSOutputStream *)writeStream;
gave it a key as kCFStreamNetworkServiceTypeVoIP and in the settings of the project said that VoIP works in background mode.
<key>UIBackgroundModes</key> <array> <string>voip</string> </array>

E
egorinsk, 2012-10-18
@egorinsk

But it seems that push was invented for such cases, no?

D
Dima Yarmolchuk, 2012-10-18
@yarmolchuk

the problem is that push does not guarantee that the user received it!

N
No_Time, 2012-10-18
@No_Time

Honestly it won't work. You can try to convince that your application is a music player, or a geolocation service. The only way.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question