Open Rahulgupta-cdnsol opened 6 years ago
I guess you need background fetch plus some logic that will only let the ws open/connect when the OS allows you to.
for the background location services is on but still it is saying "Did close Stream end encountered". Please let me how to keep alive the websocket connection.
In case you are using latest iOS versions (above 10) there is no way to keep it open!
That is a restriction from Apple!
The way to go is to shutdown the connection when going to background. And a push server send you a push notification to wake you up and reestablish the connection again.
Personally I haven't found any other way to go!
First of all,
"In case you are using latest iOS versions (above 10) there is no way to keep it open!"
this is wrong!!
With the backgroundTask it is possible, I am able to connect to the socket on background without any problem though my app is using voip. I don't know you case but it might be limited. Check the documentation.
Please let us know the solution!@kutayinclr
With the backgroundTask it is possible, I am able to connect to the socket on background without any problem.
This is a sort time solution as you cannot guarantee how long it will run, system provide you some extra time to finish-up what it is needed for your application.
According to documentation
Apps running background tasks have a finite amount of time in which to run them. (You can find out how much time is available using the backgroundTimeRemaining property.)
You can check more details here
Hi,
I am using this library and I want to keep alive my web socket but I observe that websocket is closed when I put my into the background for few mins.To keep running app in background I have added location services but still websocket is closing. Please let me know how I can keep alive the websocket.