Does Reachability guarantee callback ordering during rapid network transitions?
0 reputation · 02 Jun 2020, 10:28 UTC
Network State Monitoring Behavior
When using the Reachability API (via SCNetworkReachabilitySetCallback) to monitor connectivity on iOS 13 through 15, the application receives notifications when the network state changes between reachable and unreachable.
Event Coalescing and Timing
In scenarios where a device rapidly toggles between Wi-Fi and cellular data, the system may trigger a burst of callbacks in quick succession. There is uncertainty regarding whether the System Configuration framework guarantees the chronological ordering of these events or if it coalesces multiple state changes into a single notification.
If an application triggers resource-heavy operations, such as recreating connection pools, upon every reachable event, rapid-fire callbacks may lead to intermittent resource exhaustion.
- Does the Reachability callback mechanism guarantee that events are delivered in the exact order they occurred?
- Is there a documented mechanism within the legacy Reachability API to throttle or deduplicate these notifications?