无法通过 HTTPS 从网站连接到 deepstream 服务器

Unable to connect to deepstream server from website over HTTPS

如标题所述,我无法从通过 HTTPS 提供服务的网站连接到 deepstream 服务器。不过我可以通过本地服务器连接它。

最初我收到以下错误:

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.

收到此错误后,我将连接字符串更改为 wss://<deepstream-domain>

但这会引发以下错误:

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

知道如何解决这个问题吗?我是否也必须在 deepstream 服务器中设置 SSL 证书?

通过向域添加 SSL 证书并在 deepstream config.yml 文件中提供 SSL 密钥路径解决了该问题。