Search code examples
websocketsocket.iodeepstream.io

Unable to connect to deepstream server from website over HTTPS


As the title mentions, I am unable to connect to deepstream server from a website which is served over HTTPS. I am able to connect it through local server though.

Initially I was getting following error:

deepstream.min.js:3 Mixed Content: The page at 'https://example.com' was loaded over HTTPS, but attempted to connect to the insecure WebSocket endpoint 'ws://<deepstream-domain>:6020/deepstream'. This request has been blocked; this endpoint must be available over WSS.

After getting this error, I changed the connection string to wss://<deepstream-domain>.

But this throws following error:

WebSocket connection to 'wss://<deepstream-domain>:6020/deepstream' failed: Error in connection establishment: net::ERR_CONNECTION_CLOSED {"isTrusted":true}

Any idea how to solve this? Do I have to setup an SSL certificate in the deepstream server as well?


Solution

  • Fixed the problem by adding an SSL certificate to the domain and providing the SSL keys path in deepstream config.yml file.