Secure wss WebSocket over SSL ERR_INSECURE_RESPONSE

I get the following error when trying to establish a secure WebSocket connection over SSL:

WebSocket connection to 'wss://...' failed: Error in connection establishment: net::ERR_INSECURE_RESPONSE

Where ‘…’ is the address of my socket server. My code for initializing the secure WebSocket is:

var socket = new WebSocket('wss://...');

Some things to note:

  • I am able to make a connection with a non-secure WebSocket just fine

  • This same secure WebSocket works 100% perfectly in ionic 1.x projects just fine: This is only an issue for my latest ionic 2 projects

  • My build is targeting a desktop browser app using ionic build browser --prod where it is being hosted from an SSL domain, and where the domain’s certificate is trusted as valid by the browser (Chrome Version 57, macOS 10.12.4 )

I’ve tried adding a Content-Security-Policy meta tag to the index file to no avail. I’ve also tried updating the config.xml with <allow-intent href="wss://*/*"/> to no avail.

Again: This same secure WebSocket code works 100% perfectly in my ionic 1.x projects. Any insight would be appreciated. Thanks in advance!

Changed the port number and got it working again: My localhost configuration allows me to override port 443. I just set it to a higher port number, i.e.: 8001. Thanks!