Rasa chat widget and occational issues with the websocket connection

I have a Angular project that embedds the official Rasa widget in one page. The site uses Nginx as a reverse proxy to forward requests to a Rasa Docker container, and I use Rasa’s socketio channel for the communication. The widget also uses the “data-initial-payload” parameter to trigger the bot - it will respond with three messages.

When I use the widget I experience unstable behavior. There are these three cases what can happen:

  • The widget works as as expected, i.e., the three initial messages appear and I can chat with the bot.
  • One or two of the three messages appear and I can chat with the bot.
  • No message appears and I cannot chat.

In the last case, the browser indicates that it cannot create a websocket connection. This is the error that I see:

WebSocket connection to 'ws://hostabcd/aa/socket.io/?EIO=4&transport=websocket&sid=j4L50ULhQQuLOUeUAAAi' failed: Error during WebSocket handshake: Unexpected response code: 200

Does anyone have ideas why this happens or has similar experiences?

Turned out to be a forwarding issuerelated to the domain.

Hello,

I am experiencing the same issue. What did you modify in in the domain to solve it?

Thank you so much.

Hi, in my case we had two reverse proxies in a row and the first one did not have the right configuration to accept the websocket connections.

Thanks for your help!