4

I am attempting to deploy a Ruby on Rails application that is being served via Thin. The application uses websockets, specifically the websocket-rails library.

This works locally. When attempting to deploy, it does not work. The websocket server is not a standalone application - the websockets are simply part of the main application server. When my javascript creates a connection to the webserver, I see the following in my production.log:

[2014-11-02T23:38:19.942236 #9154]  INFO -- : Started GET "/websocket" for <IP ADDRESS> at 2014-11-02 23:38:19 +0000

There is nothing else related to the websocket request in production.log. In my websocket_rails.log, I see:

[32mConnectionManager^[[0m] Connection opened: #<Connection::b2b0d6b0e3faa4432b0c>
[32mConnectionManager^[[0m] Connection closed: #<Connection::b2b0d6b0e3faa4432b0c>

Showing that the request did reach the websocket code, and the connection was promptly closed. In the browser, I see the

WebSocket connection to 'ws:/<DOMAIN>/websocket' failed: Error during WebSocket handshake:  Unexpected response code: 200

I have found very limited information regarding this error. Is there an easy way to debug these errors? Inspecting the data in Chrome Inspector shows the following for the request to /websocket: enter image description here

I'd like to think I'm missing a simple configuration but have to discover what that might be. Any ideas?

Thanks!

NolanDC
  • 1,041
  • 2
  • 12
  • 35
  • 1
    Are you using nginx? Maybe there is some sort of configuration issue going on there. This question might help if you are: http://stackoverflow.com/questions/15992145/nginx-1-3-13-reverse-proxy-websockets – trueinViso Nov 07 '14 at 23:31
  • I am using nginx, but I don't have a reverse proxy set up. The websockets are not standalone, they are part of the base app. I will look further into my nginx configuration though. Thank you. – NolanDC Nov 10 '14 at 22:28
  • I am also using nginx as a proxy to thin using websocket-rails and I had to add an entry for the websocket. – Samo May 07 '15 at 16:15

1 Answers1

0

I had a thin server running on my local machine to run an app, and it didn't work when I deployed to production. I had to set up a separate app on Heroku just to run a separate server. Maybe this would work for you?

AMB
  • 315
  • 6
  • 14