After 10 minutes of network inactivity network events are no longer delivered to the NSInputStream in my app.
During this 10 minute period the app is not deactivated, backgrounded or terminated. I confirmed this when reproducing this with lldb because my AppDelegate would have logged these events. When testing on my device without attachment to lldb I kept the device awake by continually tapping it.
During the 10 minute period I interact with the UI elements of the app.
At the end of the 10 minute period I trigger the app to write to the NSOutputStream for the socket. Immediately after the write to the NSOutputStream the NSInputStream notifies my app of the pending data to read. During this 10 minute period the socket is not closed or disconnected.
If the network idle period is only 9 minutes the socket properly processes read events.
This seems pretty odd because the socket is not closed or reconnected (I confirmed that on both the client and server) and also because the app is not backgrounded or suspended and the phone is not locked.
I have <key>UIRequiresPersistentWiFi</key><true/>
in my Info.plist. However I think that would only have impact at the 30 minute mark.
I can reproduce this in the IOS simulator or on a physical device and on IOS 9.1 and 92. On a physical device I reproduced this both with and without lldb. When testing on my device i used wifi.
I think I can add a workaround by making my app send a heartbeat to the server at the 10 minute mark, but as far as I can tell that shouldn't be required.
I would appreciate any help with this.
Thank you!