I use with tubesock gem to add websockets support to my application Rails 4. Everything works fine on the localhost, but after deploy to DigitalOcean via Cloud66 I get an error while connecting to it from http://www.websocket.org/echo.html:
WebSocket connection to 'ws://example.development.c66.me/live?encoding=text' failed: Unexpected response code: 503
Only difference in configuration is that I use PUMA server locally and Passenger in the stack.
live_controller.rb
class LiveController < ApplicationController
include Tubesock::Hijack
def index
hijack do |tubesock|
tubesock.onopen do
tubesock.send_data "Hello, stranger!"
end
tubesock.onmessage do |data|
tubesock.send_data "You said: #{data}"
end
end
end
end
routes.rb:
...
get "/live" => "live#index", as: "live"
...
What could be the root of this problem?
Have you tried using Unicorn on the production side? (http://help.cloud66.com/web-server/custom-webserver.html)
It might help as when using Unicorn the version and configuration of nginx that is deployed by Cloud 66 works with WebSockets.