Answer the question
In order to leave comments, you need to log in
Why does the error occur: "WebSocket connection to 'ws://site.com/cable' failed: Unexpected response code: 404"?
I am writing an application on RoR 5. I am launching the project on port 3020. I'm doing a chat on this video.
Got to 8:50 in the video. At this stage, I get an error in the browser console:
WebSocket connection to 'ws://site.com/cable' failed: Unexpected response code: 404
App.chat.speak()
Started GET "/cable" for HERE_SERVER_IP at 2016-07-09 15:58:46 +0300
Cannot render console from HERE_CLIENT_IP! Allowed networks: 127.0.0.1, ::1, 127.0.0.0/127.255.255.255
Started GET "/cable/"[non-WebSocket] for HERE_SERVER_IP at 2016-07-09 15:58:46 +0300
Failed to upgrade to WebSocket (REQUEST_METHOD: GET, HTTP_CONNECTION: close, HTTP_UPGRADE: )
Finished "/cable/"[non-WebSocket] for HERE_SERVER_IP at 2016-07-09 15:58:46 +0300
Answer the question
In order to leave comments, you need to log in
if the socket returns a status other than 101, the connection will not be established
. The default ports are the same as for http - 80 for ws and 443 for wss
if your socket is up on port 3020 and there is no reverse proxy in front of it, then connect like this:
ws:/ /site.com:3020/cable
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question