Connection error - socket io

Hi ,

I am trying to connect to my rasa instance via python socket io client to perform a test. RASA is up & running and enabled for /socket.io

Below is my client code:

import socketio

sio = socketio.Client()
sio.connect("http://localhost:5005/socket.io", transports= 'websocket')

When I run this, I can see User OLjL2P8m2rj3TRm4AAAA connected to socketIO endpoint. followed by the below Traceback on the rasa server side.

Traceback (most recent call last):
  File "d:\venv\rasax_0_31_5\lib\site-packages\engineio\asyncio_server.py", line 447, in _trigger_event
    ret = await self.handlers[event](*args)
  File "d:\venv\rasax_0_31_5\lib\site-packages\socketio\asyncio_server.py", line 516, in _handle_eio_connect
    return await self._handle_connect(sid, '/')
  File "d:\venv\rasax_0_31_5\lib\site-packages\socketio\asyncio_server.py", line 435, in _handle_connect
    namespace=namespace))
  File "d:\venv\rasax_0_31_5\lib\site-packages\socketio\asyncio_server.py", line 405, in _send_packet
    await self.eio.send(sid, encoded_packet, binary=False)
TypeError: send() got an unexpected keyword argument 'binary'

On the client side, I see a Connection error as below.

Any direction to resolve this. Thanks in advance.

@siriusraja update the versions of

python-engineio 
python-socketio 

May be it will solve your issue or update the rasa version.

2 Likes

Hi @nik202

Thank you for the suggestion. Upgrading python-engineio & python-socketio solved the issue.

1 Like

@siriusraja please close this thread with the solution for others thanks.

@siriusraja Hi, can you update the Topic post category to rasa open source and close this thread with the solution for others. Thanks.

@nik202 pls guide me on how to mark the post as solution. I don’t see the solution button.

@siriusraja are you able to change the topic category from Announcements, Release Announcement to Rasa Open Source which is showing under your topic “Connection error - socket io” change it and you will be able to solve.

Hi Nimit , I have rasa 2.5.0 version . I tried using 1.0.3 cdn version

Yet I get

2022-01-22 15:11:09 DEBUG rasa.core.channels.socketio - User evy1fyqGKFgj3WTyAACa connected to socketIO endpoint. connect async handler error Traceback (most recent call last): File “/home/nlpuser/.local/lib/python3.6/site-packages/engineio/asyncio_server.py”, line 456, in _trigger_event ret = await self.handlersevent File “/usr/lib64/python3.6/asyncio/coroutines.py”, line 110, in next return self.gen.send(None) File “/home/nlpuser/.local/lib/python3.6/site-packages/socketio/asyncio_server.py”, line 487, in _handle_eio_connect return await self._handle_connect(sid, ‘/’) File “/usr/lib64/python3.6/asyncio/coroutines.py”, line 110, in next return self.gen.send(None) File “/home/nlpuser/.local/lib/python3.6/site-packages/socketio/asyncio_server.py”, line 408, in _handle_connect namespace=namespace)) File “/usr/lib64/python3.6/asyncio/coroutines.py”, line 110, in next return self.gen.send(None) File “/home/nlpuser/.local/lib/python3.6/site-packages/socketio/asyncio_server.py”, line 378, in _send_packet await self.eio.send(sid, encoded_packet, binary=False) TypeError: send() got an unexpected keyword argument ‘binary’

Can you explain to me your use case in more detail please and error traceback?

Nothing much I wanted to use this socket io rasa web chat .So first I tried to check if there is any issue with code . I have made needed changes in cred file ran with cors “*” yet in UI inspect I see ET http://xxxxx:5008/socket.io/?EIO=4&transport=polling&t=Nw2OCl0 net::ERR_CONNECTION_REFUSED

And bot end above error

@vaidehi Ok, can you please share your rasa webchat snippet code with me?

I initially felt it must be CORS but when I debugged I found a debug log rasa.core.channels.socketio - User evy1fyqGKFgj3WTyAACa connected to socketIO endpoint. So now I dont know why is socketio throwing unauthorized error and

Its prohibiting me to upload cant paste also GitHub - botfront/rasa-webchat: A feature-rich chat widget for Rasa and Botfront same I used

You not able to paste huh ?

yes

@vaidehi confirm with me what you have mentioned in @1.x.x

In code I mentioned 1.0.1 “https://cdn.jsdelivr.net/npm/rasa-webchat@1.0.1/lib/index.js”)

@vaidehi Ok and in socketUrl:?

http://xx.xx.xx.xx:5008 rasa run --cors “*” -p 5008 --enable-api

@vaidehi you are using 5008? and your rasa server is also running on 5008?