Skip to content

Session closed after 30 sec on watchOS #2

@msundman78

Description

@msundman78

Thanks for a great project.

First off, I'm a little curious at how you got Websockets working on watchOS at all. Regardless of what I try with my own implementation my Websocket session gets blocked by NECP policy when running on a real Apple Watch (works in simulator):

nw_endpoint_flow_failed_with_error [C3 api.openai.com:443 failed parent-flow (unsatisfied (Path was denied by NECP policy), interface: pdp_ip0, ipv4, ipv6, uses cell, LQM: moderate)] already failing, returning

Then I found your example-repo using AIProxy with Direct Connection, which actually works on my physical Apple Watch S10. BUT, the connection is always terminated after 30 seconds with error:

Task <347761E1-107A-4125-84AE-E790F321EC82>.<1> finished with error [-1005] Error Domain=NSURLErrorDomain Code=-1005 "The network connection was lost." UserInfo={NSErrorFailingURLStringKey=https://api.openai.com/v1/realtime?model=gpt-realtime, NSErrorFailingURLKey=https://api.openai.com/v1/realtime?model=gpt-realtime, _NSURLErrorRelatedURLSessionTaskErrorKey=( "LocalWebSocketTask <347761E1-107A-4125-84AE-E790F321EC82>.<1>" ), _NSURLErrorFailingURLSessionTaskErrorKey=LocalWebSocketTask <347761E1-107A-4125-84AE-E790F321EC82>.<1>, NSLocalizedDescription=The network connection was lost.}

Same error regardless if I connect over WIFI or 4G on the physical watch, but works fine for more than 30 seconds in the simulator. So it feels like it is some damn policy in watchOS that cuts the connections, and also blocks me from reconnecting again. If I try reconnecting with AIProxy I get the same NECP policy error as my own implementation.

Also tested running it on my iPhone 16Pro, and there it works fine as well.

Any tips?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions