WebSocket Connection Fails in Safari iOS 18.1+ when triggered from an iframe

Hello, I’m encountering a problem with WebSocket connections in Safari on iOS 18.1 and later when initiated from an iframe. The same implementation works perfectly in other browsers like Chrome but fails in Safari.

In Safari, the WebSocket connection fails with error message

"WebSocket connection to 'wss://MY_CONNECTION_URL' failed: The internet connection appears to be offline."

Has anyone else faced this? Is this a known limitation or bug in Safari? Any workarounds or solutions would be greatly appreciated.

Thank you!

I wanted to provide more context about our specific setup.

We have multiple tiered iframes with 2 WebSocket connections in different iframes where one WebSocket connection is successful while the other fails. Both WebSocket connections are to the same domain.

WebSocket Connection Fails in Safari iOS 18.1+ when triggered from an iframe
 
 
Q