An error occurred in the website where workerman connects to httts

error prompt: WebSocket connection to "wss:// (URL): 2346" failed: Error in connection establishment: net::ERR_SSL_PROTOCOL_ERROR
I think it may be the certificate

Source code input: ws = new WebSocket ("wss:// (URL: 2346");

if you connect to a website that is http, use: ws = new WebSocket ("ws://: 2346"); you can remove s. I understand that.

now it is stuck on the connection https. The server is the pagoda. The linux, server is the Ali cloud server, and the nginx1.12,

.

is based on php"s TP5.0 framework, and is installed with ThinkPHP5"s workerman extension officially developed by ThinkPHP

Thank you very much!

Jun.21,2021

just configure a ssl proxy with nginx.

server {
  listen 4431;

  ssl on;
  ssl_certificate /etc/ssl/server.pem;
  ssl_certificate_key /etc/ssl/server.key;
  ssl_session_timeout 5m;
  ssl_session_cache shared:SSL:50m;
  ssl_protocols SSLv3 SSLv2 TLSv1 TLSv1.1 TLSv1.2;
  ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;

  location /
  {
    proxy_pass http://127.0.0.1:2346;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "Upgrade";
    proxy_set_header X-Real-IP $remote_addr;
  }

  -sharp location / {} ...
}

ssl_certificate / etc/ssl/server.pem;
ssl_certificate_key / etc/ssl/server.key;
is a certificate related file

ws = new WebSocket ("ws:// (URL: 4431");


server.
location / websocket (casually named here)
{

proxy_pass http://0.0.0.0:2346;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header X-Real-IP $remote_addr;

}
-other configurations of the sharp location / {} site.

ws = new WebSocket ("wss:// / websocket" when connecting;
this website that connects http and https is fine.

Menu