Hi all,
I’m developing a watchOS app that uses a WebSocket API to process voice audio. However, I keep encountering this error when trying to establish the connection:
nw_endpoint_flow_failed_with_error [C1 <server URL>:443 failed parent-flow (unsatisfied (Path was denied by NECP policy), interface: ipsec2, ipv4, ipv6, proxy)] already failing, returning
I’ve read Technical Note TN3135, which outlines an exception for audio streaming apps. My app is an audio streaming app, and I’ve already added background audio mode to the app’s capabilities. However, I’m not sure what else is required to meet the exception described in TN3135.
Questions
- How do I meet the exception outlined in TN3135 for WebSocket audio streaming on watchOS?
- Does NECP enforce additional restrictions even with background audio enabled, and how can I address this?
Any guidance or examples of implementing WebSocket audio streaming on watchOS would be greatly appreciated.
Thanks!
Thanks Quinn!
Switching to the asynchronous activate function is exactly what fixed it.
For other readers, here's the commit with the fix: https://github.com/leptos-null/WatchOS-WebSocket/commit/57d5899965063962d9fdf73b379e562658fa0084
Comments from the commit copied here for convenience:
in my testing on watchOS 26.6 (on both an Apple Watch Series 7 and Series 10 with the same results), the synchronous
AVAudioSession.setActive()version of this method does not throw, however calling the synchronous version is not sufficient to enable use of WebSockets.
Additional note:
when I start my audio session, watchOS presents its Connect a Device UI.
In my testing, this UI only presents if you pass .longFormAudio to policy in the setCategory call, which was not required for WebSockets to become available to the process.