• nginx反代ws 支持wss协议

    location /ws { proxy_pass http://localhost:7026; proxy_read_timeout 60s; proxy_http_version 1.1; proxy_set_...

    一段代码,让你的网站同时支持ws以及wss

    话不多说 上代码 var httpswebsocket=''; var httpwebsocket=''; if(document.location.protocol=='https:'){ws = new WebSocket("wss://"+httpswebsocket);}...