1.先查是否开启了socket端口
2.需要配置 你得nginx
ws://域名/wss(可自定义)文章来源:https://www.toymoban.com/news/detail-713987.html
nginx 配置文章来源地址https://www.toymoban.com/news/detail-713987.html
location /wss(可自定义 必须 和上面一直)/ {
proxy_pass http://127.0.0.1:9404/; #通过配置端口指向部署websocker的项目
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header X-real-ip $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
}
到了这里,关于WebSocket connection to failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!