Why does my wss:// (WebSockets over SSL/TLS) connection immediately disconnect without giving any errors?

前端 未结 3 431
情书的邮戳
情书的邮戳 2020-12-01 07:45

Posting this for anybody else running across the same problem.

I was working on a browser client that used stanza.io to connect to an XMPP server (Prosody, in my cas

3条回答
  •  无人及你
    2020-12-01 08:25

    Remember that modern browsers do not like self-signed certificates. Therefore, if your secure WebSocket connection dies before ending the handshake, it could mean that the certificate has not been accepted. In order to solve the issue, you can:

    • buy a certificate signed by a Central Authority
    • simply open in a new Tab or Window the link of you WebSocket's URI and tell the browser to trust the connection. Come back to your WebSocket and it should work.

提交回复
热议问题