Websocket-Rails gem running as standalone timesout trying to connect to Thin on live server

随声附和 提交于 2020-01-17 14:52:28

问题


I'm setting up this app that contains a chat module and everything is working fine on localhost.

Now I am trying to connect to the server as a standalone service, but the connection state in the dispatcher is always 'connecting' until it finally times out with the following message:

WebSocket connection to 'ws://myserver:3001/websocket' failed: Error in connection establishment: net::ERR_CONNECTION_TIMED_OUT

Gemfile

gem 'faye-websocket', '0.10.0'
gem 'websocket-rails', github: 'moaa/websocket-rails', branch: 'threadsocket-rails'
gem 'websocket-rails-js', github: 'websocket-rails/websocket-rails-js', branch: 'sub_protocols'
gem 'puma', group: [:development, :test, :production]

Javascript

var dispatcher = new WebSocketRails(WEBSOCKET_URL);

dispatcher.on_open = function(data) {
    console.log('Connection has been established: ', data);
};

Initializer

WebsocketRails.setup do |config|
    config.log_level = :debug
    config.log_path = "#{Rails.root}/log/websocket_rails.log"
    config.log_internal_events = false
    config.standalone = true
    config.synchronize = false
end

And I am starting the service as explained here: https://github.com/websocket-rails/websocket-rails/issues/302

If I change the URL/Port in the dispatcher, i get different errors. but the one that should work takes like 2 or 3 minutes and then times out.

Have you got any ideas on what could be happening? Is there any special configuration I must set?

来源:https://stackoverflow.com/questions/37285483/websocket-rails-gem-running-as-standalone-timesout-trying-to-connect-to-thin-on

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!