2023-07-29 egg-socket.io部署后,ngi
2023-07-28 本文已影响0人
罗不错
location /socket.io/ {
proxy_http_version 1.1;
proxy_set_header Upgrade host;
proxy_pass http://127.0.0.1:8089/socket.io/;
}
本地socket访问时,用的是域名 +/socket.io/ ,所以nginx只需要针对socket.io来转发,转发到相应的服务即可,不同于接口
const socket = io("https://9a4474x44.goho.com/", {
query: {},
transports: ["websocket"],
reconnection: true,
autoConnect: true,
})