iOS 15: Websocket inside WKWebView issue

Viewed 2572

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: ]

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?

1 Answers

It seems that the issue is related with websocket compression on IOS 15 (permessage deflate). Disabling the compression for ios 15 devices on the server side helped.

This is obviously not a solution, but only a quick fix (if you have an access to the server). Here is a discussion on the same topic.

Related