美文网首页
2023-07-29 egg-socket.io部署后,ngi

2023-07-29 egg-socket.io部署后,ngi

作者: 罗不错 | 来源:发表于2023-07-28 02:02 被阅读0次

    location /socket.io/ {
    proxy_http_version 1.1;
    proxy_set_header Upgrade http_upgrade; proxy_set_header Connection "Upgrade"; proxy_set_header Hosthost;
    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,
      })
    

    相关文章

      网友评论

          本文标题:2023-07-29 egg-socket.io部署后,ngi

          本文链接:https://www.haomeiwen.com/subject/goprpdtx.html