Hi @DTS Engineer ! As we've taken some time to deep-dive into this, we're running into a dead-end here and are hoping to seek further guidance. To clarify, when our test iPhones (iPhone 15 on iOS 18.5, and iPhone 16 Pro on iOS 18.4) are locked and the app is backgrounded, the app extension will stop receiving the keep-alive messages over the SSE connection. Given our solution supports first responders, it is critical that the connection is stable to allow critical notifications to arrive as quick as possible.
If the app does not receive the keep-alives from our local server within 5s, it tears down the connection and establishes a new one.
While testing at home on an Eero router and TP Link Deco XE75 Pro, I have been unable to reproduce any issues with it. I will leave the phone, unplugged, with the app running in the background and it works as expected.
Given this, we determined our issue was likely with the vendor who supplies our customer routers, which are Cradlepoint IBR900s. We have been working with the Cradlepoint engineering team to investigate a possible root cause.
However, to help debug, Cradlepoint also purchased a TP-Link XE75 Pro in their lab to test with, along with our local server and they are able to replicate the issue within 1min of locking their iPhone.
I ended up changing my wi-fi name to kick all devices off the network except for my iPhone 16 Pro (cellular and wifi connections) and the server connected via LAN to the TP-Link. Now, every time I lock the phone, within 1min it sends a push notification indicating it lost connection and then immediately reconnects.
Given this, it seems like the behavior is not unique to a particular router after all, but has something to do with the iPhone's power saving mechanism given it's only when the phone is locked and not on power.
We have tested with iPhone 13 on iOS 16.7 (wifi only and no other apps), iPhone 15 on iOS 18.5 (wifi only and no other apps), iPhone 16 Pro on iOS 18.5 (cellular, many apps, and wifi assist turned on/off), and iPhone 14 Pro on iOS 18.5 (cellular, many apps, and wifi assist turned on/off).
I am suspecting that the small keep-alive packets going from the server to the phone every second are too small to keep the phone from powering down the wifi radio, yet there is some other device, or traffic, on my home network that presumably keeps the phones active that has no other applications installed but our app from testflight.
For our implementation, we were originally using URLSession to establish the connection and parse the SSE events, but have since moved to a custom solution leveraging Apple's Swift-NIO library. Though SSE is uni-directional connection, we also tried enabling keep-alives from the phone, with the thought that it would help generate traffic to keep the phone active.
- Do you have any ideas as to what might be keeping the wifi radio active when the phone is locked?
- Do you have any information around how the phone's power saving mechanism works?
- You seemed to indicate before that this framework tends to only work properly on "high quality networks." Could you elaborate on what makes a high quality network?
- Are there specific network settings recommended by Apple for this framework to work right? Do you know of a router that you have tested with in the lab that works reliably?
- Do you suggest we open up a code-level support request via our developer account to get further assistance on this?
- Is there anything else you haven't already mentioned that might be relevant here with our setup?
Thank you again for all of your support on this. Our partners at Cradlepoint are eager to collaborate with our company to find a solution to this as well, so please let us know if there is any other information we can provide on this.