iOS 15 WKWebView websocket behaviour

Hello,

in our app we are reliant on a web socket inside a WKWebview. In previous releases this web socket worked well. In the iOS 15 betas though this web socket behaves differently: it connects to our server successfully but once the client tries to send any data through it the web socket throws an error and closes with a non descriptive error:

The operation couldn’t be completed. (kNWErrorDomainPOSIX error 54 - Connection reset by peer)

Looking into the system log the deepest error I can make out is:

nw_protocol_boringssl_error(1772) [C12.1.1:2][0x102e0d540] Lower protocol stack error post TLS handshake. [54: <private>]

A test web socket to another server seems to be working.

I also notices that a MitM proxy like Charles no longer shows web socket connections in the iOS 15 beta. This just indicates that something might have changed.

Because the communication via this socket is very important for the functionality of our app I must know what the issue is. I tried adding ATS exceptions for the URL of the socket to no avail.

Maybe this is a temporary bug in iOS 15 that will be fixed until its released? Or maybe anyone has experienced this kind of error in the past?

So Safari completely broke a ton of people's code and then refuses to even acknowledge the problem. Typical.

Hi we have same problem, did anyone solve this issue. how can disable NSURLSession on WKWebview ?

I am having this issue but only with 14.7.1 and 14.8. 15 actually works for me. Very simple websocket application on virtual hosted server (dreamhost) with SSL from letsencrypt. frustrating. exact same web app works fine on other versions of ios.

Safari … refuses to even acknowledge the problem.

What sort of acknowledgement are you looking for?

Safari is an app and so it doesn’t acknowledge things. I’m a person, and I do say things that folks interpret as being from Apple. I’ve made a number of posts on this thread, including this, this, this, and this. I think that’s pretty good coverage of this issue, especially when combined with the helpful info posted by other third-party developers.

My last post on this thread also included a call to action on your part.

If you have a specific question that remain unanswered, please post them here and I’ll do what I can. And I’d appreciate that question coming with a bug number.

Share and Enjoy

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

I'm facing a similar issue, where the server in my cordova app (server based on https://github.com/zwopple/PocketSocket) actually crashes if a iOS 15 client (iOS 15.0.2 in this particular case) tries to send data.

The error happens here:

// inflate if necessary
if(_pmdEnabled && !frame->control && (frame->rsv1 || _initialFrame->rsv1)) {

(Line 682 of PSWebSocketDriver.m of said library)

The error message marks this as the source of the error: _initialFrame

And this is the error: Thread 30: EXC_BAD_ACCESS (code=1, address=0x9)

I've tested sending messages to the public websocket server test page https://libwebsockets.org/testserver/, mentioned by @DirtyHerri. The connection is established, but if I send data using the "Send Junk" button, the connection is closed, so I guess something similar is happening there. Toggling NSURLSession WebSocket in Safaris experimental features section doesn't have any effect for me.

This issue is still not solved in IOS 15.2

It's easy IOS15 NSURLSession WebSocket is default On, server receive multiple frame. change server code to solve sticking and unpacking problems

Our application is H5 / cordova / wkwebview, we are also facing exactly the same problem, the test to manually close NSURLSession, it is effective in safari browser.

Does anyone know the exact solution? Or know how to close NSURLSession in wkwebview?

We have evaluated to switch to cordova-plugin-advanced-websocket, but the cost is a bit high, and we cannot make this decision yet.

=== delete repeat post ===

Is there any word on whether this will be addressed at some point? This is a big problem for our business and we don't really see a way to work around this (we tried different server side websocket configurations, but so far no luck).

This used to work in iOS 14. Is there any way to configure the WKWebView to use the legacy code for now? Should we pull the app from the App Store for now? Is there any recommendation by Apple on how to handle this?

Same here, having the same issues with web socket in IOS 15 safari browser. We can’t ask everyone who are viewing our website to turn off NSURLSession WebSocket experimental features 😂 if they are using Safari. It is working for IOS 14, for my colleagues who haven’t upgraded, asking them to hold back on upgrading cause IOS is buggy

Its been over many months now, my ticket (https://feedbackassistant.apple.com/feedback/9665293) had no responses. Can the technical team update the status about this? Otherwise I'll have to make other decisions since I can't hold off the IOS upgrades any longer.

I have tested IOS 15.3, the issue remains.

Sorry, I wrote to the wrong thread. Please disregard.

My nodejs->socket.io webapp runs on ios15.3 when opened via http in the lan if i use the same app via https via nginx, the websocket fails. we also allowd tls1.2 and disabled this NSUrl, but nothing helps at the moment.

iOS 15 WKWebView websocket behaviour
 
 
Q