macOS webview insecure websocket to localhost

Hi,

I wrote an app which loads a https webpage that do something like:

var socket = new WebSocket('ws://localhost:31105');

I get no communication to the local running and listening app. I already tried to add some stuff to the Info.plist of the app which shows the webview:

<key>NSAppTransportSecurity</key>
  <dict>
    <key>NSAllowsLocalNetworking</key>
    <true/>
    <key>NSExceptionDomains</key>
    <dict>
      <key>localhost</key>
      <dict>
        <key>NSExceptionAllowsInsecureHTTPLoads</key>
        <true/>
      </dict>
    </dict>
  </dict>

But I stil can not see any traffic. If I open the webpage in safari I can see the error that unsecure access is denied. But I can not add this stuff to a safari plist file for testing, or ... can I? It is not iOS it's macOS. Any ideas?

macOS webview insecure websocket to localhost
 
 
Q