NEAppPushProvider times out connecting to a server on a routed subnet, while the containing app connects fine

We use Local Push Connectivity (NEAppPushProvider, matchSSIDs set) to receive notifications from an on-premise MQTT broker over WebSocket (wss://host:port/mqtt).

  • iPhone on Wi-Fi, VLAN A (SSID matches matchSSIDs)
  • Server on wired VLAN B, routing and firewall rules allow VLAN A → VLAN B on that port

Result: the containing app, in the foreground, connects successfully to wss://<VLAN B IP>:<port>/mqtt. At the same moment, the app push provider (URLSessionWebSocketTask to the exact same URL) fails with "The request timed out". The provider starts normally (start() is called).

When the server has an address on the Wi-Fi subnet (VLAN A), the provider connects without any issue.

Is the app push provider restricted to servers on the local subnet of the matched Wi-Fi network? If so, is this documented anywhere? If not, what could prevent the provider from reaching a routed address that the app itself can reach?

iOS version: 27.0.1 device : iPhone 13

Written by Tristan_Vct in 856425021

URLSessionWebSocketTask to the exact same URL

Hmmmm, what happens if you use Network framework for this?

In general, we recommend using Network framework for WebSocket rather than URLSession. See TN3151 Choosing the right networking API. And Network framework gives you a lot more control over how you connect, which is likely to come in handy in this case.

I recommend that you start by using Network framework to open a vanilla TCP connection to the server. That determines whether things are working at the network level, so you can then focus any investigation below that level (network interface choice, network interface access control, and so on) or above (TLS, WebSocket).

Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"