1

When opening this web page I get the following errors in the debug console:

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

I think it is related to index.html configuration

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/rasa-webchat@0.11.5/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>

My environment:
rasa chatbot running in docker, port 5005 opened. Apache2 web server. All running in Azure Ubuntu 18.04 server.

More info

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

and I get this text from index.html to website, you can try yourselves too

// moro you can add a version tag if you need, e.g for version 0.11.5 https://cdn.jsdelivr.net/npm/rasa-webchat@0.11.5/lib/index.min.js

Glorfindel
  • 1,213
  • 3
  • 15
  • 22
Innoomnia
  • 11
  • 3
  • Does this answer your question? [What causes the 'Connection Refused' message?](https://serverfault.com/questions/725262/what-causes-the-connection-refused-message) – Michael Hampton Sep 28 '20 at 13:55
  • Unfortunately not – Innoomnia Sep 28 '20 at 15:05
  • localhost is not the correct hostname! You can't access it from any other computer than the one it runs on. – Michael Hampton Sep 28 '20 at 16:30
  • Thank you Michael but this local host is used for connecting to docker where Rasa is running. I have opened port 5005 at docker for that usage – Innoomnia Sep 28 '20 at 17:30
  • Your web browser does not run on that host! – Michael Hampton Sep 28 '20 at 18:02
  • Thank you Michael again, but think it is not the case here. I have apache webserver running and serving that index.html to public internet i.e. aspabotti1.omnia.fi:444 – Innoomnia Sep 29 '20 at 09:10
  • You missed the point again. You told the web browser to connect to a websocket server on localhost! It is not on localhost. Localhost means the same machine. So the web browser cannot connect to it because the websocket server is not on the same computer as the web browser. – Michael Hampton Sep 29 '20 at 12:45
  • Now it is working; I needed to ask IT server people to open ports on server side – Innoomnia Oct 13 '20 at 10:24

0 Answers0