I’ve been using rasa for a chatbot that i want to use within Unity.
I’m using the Socket.IO input channel to host a local server.
The server is working fine! I can get info from it and talk to the chatbot via command line.
But when i try to post to the server from my Unity client i get an unknown/generic error.
I’ve tried to post to /webhooks/socketio/webhook & /webhooks/rest/webhook and some other ones that i could find in code examples and the documentation.
As you can probably tell, i haven’t been using python and rasa all that long.
Can anyone help me out?
I’d like to know which address to post to and in what format.
The code i was using was not working correctly. I discovered it after making various socket.io clients and servers. With and without rasa.
Found a nice package on github that works instead.
For anyone reading this, it’s not entirely plug-and-play. Its very bare-bones and eg. doesn’t disconnect the client properly when exiting the program.
Hello Mark, i am trying to use Socket.io too but i am kinda stuck. Do not find the Documentation that describes how to establish a connection with Socketio Server . Are there more examples on this? Thanks and and all the best
have just started on that endeavor as well – did you have any pointers as this is an old thread? I’ve looked through the docs (which I think are wrong as they mention accessing the sockets via http://localhost:5005/ instead of something like ws://localhost:5005.
Is it necessary to use the mr. bot AI widget to get it working properly with Rasa?
I was able to get things fixed, but I had to avoid using websockets for now.
I believe the first call is correct; it should first establish connection via http://localhost:5005/ or whatever the root server URI is, because the websocket client will handle creating the connection itself.
Hey @niveK. We have similiar issue as you. We got it working with http and transport=polling, but even though we are using mr.bot webchat ui, it never switches to WS protocol. I.e. it never upgrades the protocol, and just runs continuous long polling. So everything works, but ONLY with long poll.
@akelad Do you know if the socketio.py channel supports upgrading to WS protocol? Or is is it only long polling? i.e. endless loop of HTTP GET/POST?
We tested Mr.Bot reach chat widget against a generic socket.io node server and we can see that it starts with HTTP get/post pair as @niveK mentioned. And then it sends an upgrade request header and polling stops and it’s working over websocket connection.
But with the rasa back end, it stays long polling.
Can you clarify what is supported?
I’m currently on Rasa core 0.13.1 (or 0.13.2) on Ubuntu 16.04, Pyton 3.6.8.
I have the exact same problem. Only long-polling is used in the mrbot chat <> socketio setup. I had a look into the python-socketio package that Rasa uses in their connector, but couldnt yet really figure out which other library it is using in the backend for deployment or how it interacts with flask. Maybe this needs to be adjusted. As you say, some clarification here would help.
Hi @Nick_Kazakov. I couldn’t get it working with Rasa 0.13.x but once I upgraded to 1.1.x it worked out of the box:
'upgrades': ['websocket'], 'pingTimeout': 60000, 'pingInterval': 25000}
2019-06-26 02:40:55 DEBUG rasa.core.channels.socketio - User 5d0291399f154a20ad71821d110f40a4 connected to socketIO endpoint.
2019-06-26 02:40:55 INFO engineio.server - 5d0291399f154a20ad71821d110f40a4: Sending packet MESSAGE data 0
2019-06-26 02:40:55 INFO engineio.server - 5d0291399f154a20ad71821d110f40a4: Received packet MESSAGE data 2["session_request",{"session_id":"9d8cbef69c684feaa7d14e9bd4bab060"}]
2019-06-26 02:40:55 INFO socketio.server - received event "session_request" from 5d0291399f154a20ad71821d110f40a4 [/]
2019-06-26 02:40:55 INFO socketio.server - emitting event "session_confirm" to 5d0291399f154a20ad71821d110f40a4 [/]
2019-06-26 02:40:55 INFO engineio.server - 5d0291399f154a20ad71821d110f40a4: Sending packet MESSAGE data 2["session_confirm","9d8cbef69c684feaa7d14e9bd4bab060"]
2019-06-26 02:40:55 DEBUG rasa.core.channels.socketio - User 5d0291399f154a20ad71821d110f40a4 connected to socketIO endpoint.
2019-06-26 02:40:55 INFO engineio.server - 5d0291399f154a20ad71821d110f40a4: Received request to upgrade to websocket
2019-06-26 02:40:55 DEBUG websockets.protocol - undefined - state = CONNECTING
2019-06-26 02:40:55 DEBUG websockets.protocol - undefined - event = connection_made(<TCPTransport closed=False reading=True 0x5f5b908>)
2019-06-26 02:40:55 DEBUG websockets.protocol - undefined - state = OPEN
2019-06-26 02:40:55 DEBUG websockets.protocol - undefined < Frame(fin=True, opcode=1, data=b'2probe', rsv1=False, rsv2=False, rsv3=False)
2019-06-26 02:40:55 DEBUG websockets.protocol - undefined > Frame(fin=True, opcode=1, data=b'3probe', rsv1=False, rsv2=False, rsv3=False)
2019-06-26 02:40:55 DEBUG websockets.protocol - undefined < Frame(fin=True, opcode=1, data=b'5', rsv1=False, rsv2=False, rsv3=False)
2019-06-26 02:40:55 INFO engineio.server - 5d0291399f154a20ad71821d110f40a4: Upgrade to websocket successful
It worked over ws and wss too, as I have apache 2.4 with certificate, and all seems fine now.
So try the latest rasa core (read upgrade manual as it’s a little different and hopefully all works for you as well)