Open ambercool99 opened 8 years ago
Any updates for this?
This is generally not a reasonable expectation for socket clients; you will need to use a VOIP socket (now-deprecated so not linking) to accomplish this at all, and even still will lose access to the socket after 3m in the background.
You can get around these limitations with some kludges; such techniques however will not pass Apple's review process.
we have already marked it as VOIP socket and app is active in background in this case. If you are using socket rocket for VOIP application and consider a case incoming call this is expected.
@AshokPitambar I'm not sure what you're trying to say, or what a helpful answer looks like. Can you try being more specific re: what behavior you've observed vs. what you'd expect? Sample code would also be helpful if you're looking for support.
@ambercool99 are you building your code with iOS SDK 9 or 10?
If you are using 10 (latest, default for xCode 8) then the behavior is as expected because Apple has removed the deprecated VOIP functionality completely from iOS 10. PushKit is the only way to go for building with iOS SDK 10.
Experiencing same issue. any idea?
platform :ios, "7.0"
target 'WebsocketExampleClient' do
use_frameworks!
pod 'SocketRocket', '~> 0.4.2'
end
messages not received from socket rocket when app is in background ? any one have solution for this issue.
Solution: For Swift
In App Delegate:
Create variable:
`var backgroundUpdateTask: UIBackgroundTaskIdentifier = UIBackgroundTaskInvalid`
Create Method:
private func endBackgroundTask(){
UIApplication.shared.endBackgroundTask(self.backgroundUpdateTask)
self.backgroundUpdateTask = UIBackgroundTaskInvalid
}
In applicationWillResignActive and WillEnterForeground Delegate:
func applicationWillResignActive(_ application: UIApplication) {
self.backgroundUpdateTask = UIApplication.shared.beginBackgroundTask(expirationHandler: {
self.endBackgroundTask()
})
}
func applicationWillEnterForeground(_ application: UIApplication) {
self.endBackgroundTask()
}
I was going to say add backgroundTask
but @tamimibnaman already explained. It should work. Since you have voip there shouldn't any problem.
Also, try to debug socket is closed or not when you send the app to background.
One more addition, I think it is best to terminate backgroundTask
when the call ended not with application states if you have voip based app.
Device: iPhone 6S iOS : 9.3.5 Socket Rocket version: 0.5.0 Steps: 1) Server sends multiple messages on Socket connection when app is in Background. (through socket rocket i have created a VOIP socket) 2) Messages are not received by socket rocket (though application is active in background as background task was running). 3) Move the application to foreground and on trying to send a message out .
Observed that all messages which were sent by server previously are getting received now.
Expected: Messages should be received whenever it is sent by server.