Problem with websockets

I followed this guide : Your Own Website for implementing the websockets however every time I try to use a websocket (widget for example) I get an error:

The WebSocket transport is not available, you must install a WebSocket server that is compatible with your async mode to enable it. See the documentation for details. (further occurrences of this error will be logged with level INFO) [2021-11-27 20:51:35 +0200] [73467] [ERROR] Exception occurred while handling uri: ‘http://127.0.0.1:5005/socket.io/?EIO=4&transport=polling&t=NrYlGcK’ Traceback (most recent call last): File “handle_request”, line 83, in handle_request class Sanic(BaseSanic, metaclass=TouchUpMeta): File “/home/ofek/Work/Voice-helper/Rasa/venv/lib/python3.8/site-packages/engineio/asyncio_server.py”, line 317, in handle_request return await self._make_response(r, environ) File “/home/ofek/Work/Voice-helper/Rasa/venv/lib/python3.8/site-packages/engineio/asyncio_server.py”, line 385, in _make_response response = make_response( File “/home/ofek/Work/Voice-helper/Rasa/venv/lib/python3.8/site-packages/engineio/async_drivers/sanic.py”, line 102, in make_response return HTTPResponse(body=payload, content_type=content_type, TypeError: ‘NoneType’ object is not callable

I’m using Rasa 3.0 and Python 3.8.10

@Vast can you tell what is your front-end for rasa integration ?

I used the widget provided in the end of the page Your Own Website


<div id="rasa-chat-widget" data-websocket-url="http://127.0.0.1:5005/"></div>
<script src="https://unpkg.com/@rasahq/rasa-chat" type="application/javascript"></script>

I ran rasa with ’ rasa run --enable-api --cors “*” ’ and added to the credentials.yml file :

socketio:
  user_message_evt: user_uttered
  bot_message_evt: bot_uttered
  session_persistence: true

I get the same issue with https://github.com/botfront/rasa-webchat as well

@Vast All right. Well firstly I never used the mentioned widget and in your mentioned code you are using localhost with https?

But, I have experience on working with rasa-webchat integration and for your convenience please see this video tutorial for deployment of rasa with rasa-dwebchat: Rasa chatbot website integration | Quick tutorial - YouTube

I wish you able to solve this issue now and good luck with your project.

I am using http not https (I accidentally copied the wrong url) and localhost. I followed the video however I get the same error. It seems that it doesnt matter what frontend I use, the problem persists.

@Vast share you rasa --version while activating environment?

Did you tried this command? rasa run -m models --enable-api --cors "*" --debug

Rasa Version      :         3.0.0
Minimum Compatible Version: 3.0.0
Rasa SDK Version  :         3.0.0
Rasa X Version    :         None
Python Version    :         3.8.10
Operating System  :         Linux-5.11.0-40-generic-x86_64-with-glibc2.29
Python Path       :         /home/ofek/Work/Voice-helper/Rasa/venv/bin/python3

Yes I started rasa with this command

@Vast ok. can you type pip list in environment and share me the version of python-engineio and python-socketio ?

@Vast Even I will suggest, please create new environment and try use rasa and rasa-sdk 2.8.1 respectively and check its working on the older version of rasa, if you got some time? Don’t disturb the current environment.

It’s working with rasa 2.81… Thank you!

for the pip list of the non working env:

python-engineio         4.3.0    
python-socketio         5.5.0 

@Vast right as expected, can you try downgrade to python-engineio to 4.2.1 and python-socketio to 5.4.0 as rasa3 is just launched so some issue can arise with packages. If the above rasa version 2.8.1 is working, don’t stop your learning please.

I downgraded both but I have the same issue with rasa 3.0

@Vast Hi, vast sorry for the late reply.

Please install :

pip install sanic==21.6.0
pip install Sanic-Cors==1.0.0
pip install sanic-routing==0.7.0

if there are any dependencies do let me know please.

Note: This solution working on rasa 3.0 and rasa webchat

Screenshot 2021-12-02 at 3.38.29 AM

2 Likes

Fixed, thank you!

@Vast Great! Happy to help you!