UnityWebSocket.WebSocket is kind of stuck in ConnectAsync while Connecting

This issue only happens to me when I build an iOS AppClip.
Was testing this on 2022.3f10 and f26.

I use an AI package that connects to a specific server from their services. This is all done with Unity’s Websocket. The uri and so on all seems fine. It also works without any issues in the editor or on a normal iOS or Android build. Only the AppClip build has issues with this. The Socket does not return anything. It just stays in the ConnectionStatus “Connecting” the whole time. There are no error logs or whatsoever.

I already tested if the Unity AppClip has Internet connection → it has
I set Code Stripping to minimal → no success
I reimported the AI package → no difference, I don’t think the package has any faults per se
I tried to start the Connection with a delay to test if any Awake, OnEnable etc. is messing up the setup → no luck, I think the problem is not within the scene

I just would like to know how I can narrow down the problem. I tried everything that came to my mind, but could not think of anything further.

Hello, @Brian_X

I give you some information I Hope your query can solve please follow information.

Troubleshooting WebSocket connection issues in an iOS AppClip can be quite challenging, especially when the problem doesn’t manifest in other environments. Here are some steps you can take to narrow down the issue:

Check AppClip Restrictions: Ensure that there are no specific restrictions for AppClips that might be affecting network connections. Apple’s documentation on AppClips might provide some insights.
Debugging: Since there are no error logs, consider adding extensive logging around the WebSocket connection code to capture any subtle issues that might not be throwing explicit errors.
Network Configuration: Verify the network configuration for the AppClip, including any Info.plist settings related to network access, to ensure they match the requirements for WebSocket connections.
SSL/TLS Configuration: Ensure that the server’s SSL/TLS configuration is compatible with iOS’s requirements. Sometimes, issues with certificates or TLS versions can cause silent failures.
Test with a Simple WebSocket Client: Create a minimal WebSocket client within the AppClip to test the connection to the server. This can help determine if the issue is with the AI package or the AppClip environment itself.
Unity and iOS Versions: Check for any known issues with the Unity version you’re using, specifically related to iOS AppClips. Upgrading to a newer version or downgrading to a stable version might resolve the issue.
Server-Side Logs: If possible, check the server-side logs to see if the connection attempt is reaching the server and if any errors are logged there.
Proxy and Firewall Settings: If your network setup involves a proxy or firewall, ensure that they are configured to allow WebSocket connections.

Remember, isolating the problem often involves changing one variable at a time and testing extensively. Patience and systematic testing will be your allies in resolving this issue. Good luck!

It turns out AppClips do not support Session Streams. At least a 3yo forum post says so https://forums.developer.apple.com/forums/thread/652104

I hope Apple would point it out better, because this is not listed in their restrictions. Maybe a future iOS Version will support it though.