Ok, I figured it out.
As I can't use insecure WebSocket inside the WKWebView if I am in HTTPS (what I want), the best option is to get rid completely of the WebSocket server and to use WKScriptMessage instead which allows to send JavaScript to native code in a WKWebView.
Furthermore, we get rid of networking issues we can have with the WebSocket server and since iOS 14, when we are receiving some JavaScript calls from WKWebView, we can also provide a response easily with a reply handler.
Thanks for the help.
Topic:
Safari & Web
SubTopic:
General
Tags: