Answer the question
In order to leave comments, you need to log in
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
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>
the problem is that push does not guarantee that the user received it!
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question