Closed ghost closed 4 years ago
It doesn't. There is no way to keep an open connection on iOS without having the phone unlocked and the app permanently open.
The app simply reconnects when it receives a push message and then syncs the state with Threema Web.
Maybe the pages in the "Concepts" section at https://threema-ch.github.io/app-remote-protocol/ help. Keeping in sync is actually not easy, because any message chunk can get lost at any time. Therefore we implemented a custom acknowledgement protocol.
Big thanks for sharing this.
Why didn't you use VOIP ?
I don't understand your question.
Sorry, my bad, looks like that API was deprecated.
In case you mean VoIP-Pushes: Besides the deprecation for non-VoIP use cases, those only help waking up your device, but the process will still be killed by iOS after ~30 seconds.
Keeping a persistent connection on iOS will not work, unless you keep the app open and the screen unlocked.
Thanks. I will try next days to experiment with reconnect, and see how it will work.
What I am doing now: maybe somehow can help Threema too.
beginBackgroundTask()
, observing UIApplication.shared.backgroundTimeRemaining
However... if Apple will throttle pushes, or user will have a bad internet connection, app will be suspended.
I'm excited about seeing SaltyRTC being used anywhere but from our own experience: You are entering a world of pain and it's unlikely to work reliably now or any time in the future (unless Apple's policy changes). They don't want permanent background activity and they are relentlessly working on enforcing that (see the iOS 13 Push Kit changes).
We have write SaltyRTC in swift, with little modifications to Tasks
(can be fixed to follow the Protocol). But still, can fully be used with your Server implementation.
We have plans to open source it, but after we launch our product, I hope it will be soon :)
Big thanks for sharing your work.
If you're done with the Swift implementation, we'll be happy to link to it from https://saltyrtc.org/pages/implementations.html :slightly_smiling_face:
@dbrgn Hi, we finally have open sourced it https://github.com/passlock/SaltyRTC There are some things to finish, but can be used already, as we are doing in @passlock
@projectvim congrats! Feel free to open a PR to add it to https://github.com/saltyrtc/saltyrtc-website/blob/master/content/pages/implementations.md and maybe to https://github.com/saltyrtc/saltyrtc-website/blob/master/content/pages/users.md as well :slightly_smiling_face:
Hi,
Out of topic question, how is Threema iOS App keeping open/alive connections to
threema-web
while in background.I am developing a
Threema-web
like web service (not a messaging app), where we useSaltyRTC
and some ideas from your amazing app. Any information on this topic will really help me.Thanks.