Back
Question
Asked

Anybody here use Websocket on Rails?

Anybody here use Websocket on Rails 5.2? I have been trying to deploy the Chat feature on my app which based on Websocket to the production server but always got this error:

WebSocket connection to 'ws://myipaddress/cable' failed: Error during WebSocket handshake: Unexpected response code: 404

and this:

WebSocket error occurred: One or more reserved bits are on: reserved1 = 1, reserved2 = 0, reserved3 = 0

I have asked the question on Stackoverflow and open a github issue as this might possibly be a bug within Rails/Passenger itself as I believed that all my configurations are correct.

Here is the links to the question:

Stackoverflow: https://stackoverflow.com/questions/52175211/actioncable-rails-5-passenger-failed-error-during-websocket-handshake-unex

Github issue: https://github.com/rails/rails/issues/33845 https://github.com/phusion/passenger/issues/2116

I have been stucked with this for weeks, and nobody seems can help with this including the mentors on Hackhands and Codementors. So posting here is my last resort. Any help is very much appreciated.


Have you checked out Rails <a href="https://guides.rubyonrails.org/action_cable_overview.html">Action Cable</a>? It should make things easier, I think.

Yes I have been using ActionCable and everything works just fine on my local machine. It's just when I deployed it to production server that I got those errors

What adapter are you using? ActionCable works best in production with an adapter like Redis or postgres.

www.phusionpassenger.com/libr…

Can you get a clean new rails app w/ the most basic actioncable/chat implementation working in production?

Just to clarify - it sounds like you might as well try something like this since you're on your last resort anyways. Maybe even try deploying to a different server such as heroku to reproduce.