Azure Linux 服务器中出现 Socket.io 错误“无法加载资源:net::ERR_CONNECTION_REFUSED”

Azure Linux 服务器中出现 Socket.io 错误“无法加载资源:net::ERR_CONNECTION_REFUSED”

打开时此网页我在调试控制台中收到以下错误:

localhost:5005/socket.io/?EIO=3&transport=polling&t=NJKuQEf:1 Failed to load resource: net::ERR_CONNECTION_REFUSED
index.min.js:129 Error: xhr poll error
    at u.i.onError (index.min.js:23)
    at l.<anonymous> (index.min.js:127)
    at l.r.emit (index.min.js:5)
    at l.onError (index.min.js:127)
    at index.min.js:127

我认为这与index.html配置有关

paulii@vetbot:/var/www/html$ cat index.html
<!doctype html>
<html>
<head>
</head>
<body>

<div id="webchat"></div>
<script src="https://cdn.jsdelivr.net/npm/rasa-webchat/lib/index.min.js"></script>
// moro you can add a version tag if you need, e.g for version 0.11.5 https://cdn.jsdelivr.net/npm/[email protected]/lib/index.min.js
<script>
  WebChat.default.init({
    selector: "#webchat",
    initPayload: "/aloitus",
    customData: {"language": "en"}, // arbitrary custom data. Stay minimal as this will be added to the socket
    socketUrl: "http://localhost:5005",
    socketPath: "/socket.io/",
    embedded: true,
    title: "Demo bot",
    subtitle: "Subtitle",
    params: {"storage": "session"} // can be set to "local"  or "session". details in storage section.
  })
</script>

</body>
</html>

我的环境
rasa 聊天机器人在 docker 中运行,端口 5005 已打开。Apache2 网络服务器。全部在 Azure Ubuntu 18.04 服务器中运行。

更多信息

paulii@vetbot:/var/www/html$ sudo netstat -tnlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 127.0.0.1:29130         0.0.0.0:*               LISTEN      1628/mdsd
tcp        0      0 127.0.0.53:53           0.0.0.0:*               LISTEN      851/systemd-resolve
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1153/sshd
tcp6       0      0 :::5005                 :::*                    LISTEN      4716/docker-proxy
tcp6       0      0 :::22                   :::*                    LISTEN      1153/sshd
tcp6       0      0 :::444                  :::*                    LISTEN      5915/apache2

我将这段文本从 index.html 复制到网站,你也可以自己尝试一下

// moro 如果需要,您可以添加版本标签,例如版本 0.11.5https://cdn.jsdelivr.net/npm/[电子邮件保护]/lib/index.min.js

相关内容