# Need some help posting to Socket.IO server

**URL:** <https://forum.rasa.com/t/need-some-help-posting-to-socket-io-server/1422>\
**Category:** Rasa Open Source\
**Created:** [September 26, 2018, 1:48pm UTC](https://forum.rasa.com/t/need-some-help-posting-to-socket-io-server/1422 "2018-09-26T13:48:47Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![MarkDiax](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/markdiax/32/571_2.png) [@MarkDiax](https://forum.rasa.com/u/MarkDiax)\
**Post date:** [September 26, 2018, 1:48pm UTC](https://forum.rasa.com/t/need-some-help-posting-to-socket-io-server/1422/1 "2018-09-26T13:48:47Z")

</div>

Hi everyone!

I’ve been using rasa for a chatbot that i want to use within Unity. I’m using the [Socket.IO](http://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.

Thanks!

---

<div class="post-metadata">

**Author:** ![akelad](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/akelad/32/69_2.png) [@akelad](https://forum.rasa.com/u/akelad)\
**Post date:** [September 27, 2018, 4:08pm UTC](https://forum.rasa.com/t/need-some-help-posting-to-socket-io-server/1422/2 "2018-09-27T16:08:28Z")

</div>

Can you post this on the rasa core repo with more details about what error you’re getting and what commands you’re running things with etc

---

<div class="post-metadata">

**Author:** ![MarkDiax](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/markdiax/32/571_2.png) [@MarkDiax](https://forum.rasa.com/u/MarkDiax)\
**Post date:** [October 1, 2018, 4:01pm UTC](https://forum.rasa.com/t/need-some-help-posting-to-socket-io-server/1422/4 "2018-10-01T16:01:36Z")

</div>

The code i was using was not working correctly. I discovered it after making various [socket.io](http://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.

Client repo: [https://github.com/floatinghotpot/socket.io-unity](https://github.com/floatinghotpot/socket.io-unity)

---

<div class="post-metadata">

**Author:** ![Kei](https://avatars.discourse-cdn.com/v4/letter/k/ac8455/32.png) [@Kei](https://forum.rasa.com/u/Kei)\
**Post date:** [April 11, 2019, 2:59pm UTC](https://forum.rasa.com/t/need-some-help-posting-to-socket-io-server/1422/5 "2019-04-11T14:59:29Z")

</div>

Hello Mark, i am trying to use [Socket.io](http://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

---

<div class="post-metadata">

**Author:** ![niveK](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/nivek/32/13710_2.png) [@niveK](https://forum.rasa.com/u/niveK)\
**Post date:** [June 4, 2019, 10:30pm UTC](https://forum.rasa.com/t/need-some-help-posting-to-socket-io-server/1422/6 "2019-06-04T22:30:21Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![akelad](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/akelad/32/69_2.png) [@akelad](https://forum.rasa.com/u/akelad)\
**Post date:** [June 12, 2019, 1:19pm UTC](https://forum.rasa.com/t/need-some-help-posting-to-socket-io-server/1422/7 "2019-06-12T13:19:57Z")

</div>

@niveK no it’s not necessary to use the mrbot widget, it’s just an already implemented widget you can use if you want.

What are you stuck with?

---

<div class="post-metadata">

**Author:** ![niveK](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/nivek/32/13710_2.png) [@niveK](https://forum.rasa.com/u/niveK)\
**Post date:** [June 12, 2019, 3:32pm UTC](https://forum.rasa.com/t/need-some-help-posting-to-socket-io-server/1422/8 "2019-06-12T15:32:04Z")

</div>

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.

Thanks again @akelad!

---

<div class="post-metadata">

**Author:** ![Serge](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/serge/32/10491_2.png) [@Serge](https://forum.rasa.com/u/Serge)\
**Post date:** [June 22, 2019, 12:53am UTC](https://forum.rasa.com/t/need-some-help-posting-to-socket-io-server/1422/9 "2019-06-22T00:53:14Z")

</div>

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](http://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.

Thank you.

---

<div class="post-metadata">

**Author:** ![martin.m](https://avatars.discourse-cdn.com/v4/letter/m/f05b48/32.png) [@martin.m](https://forum.rasa.com/u/martin.m)\
**Post date:** [June 24, 2019, 4:27pm UTC](https://forum.rasa.com/t/need-some-help-posting-to-socket-io-server/1422/10 "2019-06-24T16:27:56Z")

</div>

+1

Hi Serge,

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.

---

<div class="post-metadata">

**Author:** ![Nick\_Kazakov](https://avatars.discourse-cdn.com/v4/letter/n/90db22/32.png) [@Nick\_Kazakov](https://forum.rasa.com/u/Nick_Kazakov)\
**Post date:** [June 25, 2019, 2:40pm UTC](https://forum.rasa.com/t/need-some-help-posting-to-socket-io-server/1422/11 "2019-06-25T14:40:03Z")

</div>

@Serge Hi, can you provide solution that get it working? How you change transport?

---

<div class="post-metadata">

**Author:** ![Serge](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/serge/32/10491_2.png) [@Serge](https://forum.rasa.com/u/Serge)\
**Post date:** [June 26, 2019, 7:06am UTC](https://forum.rasa.com/t/need-some-help-posting-to-socket-io-server/1422/12 "2019-06-26T07:06:52Z")

</div>

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) 🤠

---

<div class="post-metadata">

**Author:** ![akelad](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/akelad/32/69_2.png) [@akelad](https://forum.rasa.com/u/akelad)\
**Post date:** [June 27, 2019, 3:12pm UTC](https://forum.rasa.com/t/need-some-help-posting-to-socket-io-server/1422/14 "2019-06-27T15:12:41Z")

</div>

glad you got it figured out!

---

<div class="post-metadata">

**Author:** ![ymehta18](https://avatars.discourse-cdn.com/v4/letter/y/b9bd4f/32.png) [@ymehta18](https://forum.rasa.com/u/ymehta18)\
**Post date:** [August 6, 2019, 11:16am UTC](https://forum.rasa.com/t/need-some-help-posting-to-socket-io-server/1422/15 "2019-08-06T11:16:58Z")

</div>

can you tell me how can i use [socket.io](http://socket.io) in rasa i want to connect my webchat to rasa i dont know how to do that please help.

---

<div class="post-metadata">

**Author:** ![SallemiDorsaf](https://avatars.discourse-cdn.com/v4/letter/s/b782af/32.png) [@SallemiDorsaf](https://forum.rasa.com/u/SallemiDorsaf)\
**Post date:** [August 13, 2019, 10:07am UTC](https://forum.rasa.com/t/need-some-help-posting-to-socket-io-server/1422/17 "2019-08-13T10:07:14Z")

</div>

hi @ymehta1 if you get the answer please tell me i can’t figure out how to do this either

---

<div class="post-metadata">

**Author:** ![akelad](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/akelad/32/69_2.png) [@akelad](https://forum.rasa.com/u/akelad)\
**Post date:** [August 16, 2019, 10:03am UTC](https://forum.rasa.com/t/need-some-help-posting-to-socket-io-server/1422/18 "2019-08-16T10:03:05Z")

</div>

@ymehta18 @SallemiDorsaf here’s the link to connecting a bot that way: [Your Own Website](https://rasa.com/docs/rasa/user-guide/connectors/your-own-website/)

---

<div class="post-metadata">

**Author:** ![SallemiDorsaf](https://avatars.discourse-cdn.com/v4/letter/s/b782af/32.png) [@SallemiDorsaf](https://forum.rasa.com/u/SallemiDorsaf)\
**Post date:** [August 16, 2019, 10:04am UTC](https://forum.rasa.com/t/need-some-help-posting-to-socket-io-server/1422/19 "2019-08-16T10:04:58Z")

</div>

hi @akelad the steps are not clear and i’m stuck with an error for 2 weeks

---

<div class="post-metadata">

**Author:** ![akelad](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/akelad/32/69_2.png) [@akelad](https://forum.rasa.com/u/akelad)\
**Post date:** [August 16, 2019, 10:25am UTC](https://forum.rasa.com/t/need-some-help-posting-to-socket-io-server/1422/20 "2019-08-16T10:25:18Z")

</div>

what are you stuck with specifically?
