初始化事件机器。瘦服务器已停止

时间:2015-05-28 10:38:31

标签: ruby-on-rails websocket eventmachine

我正在使用Websocket Rails。在我的本地服务器上它工作正常(在生产和开发环境中)。但是,当我将我的应用程序部署到远程服务器时,我尝试连接时出错:

RuntimeError (eventmachine not initialized: evma_install_oneshot_timer):

我发现这解决Websockets not working in my Rails app when I run on Unicorn server, but works on a Thin server 我写了config / initializers / eventmachine.rb这段代码:

Thread.new { EventMachine.run } unless EventMachine.reactor_running? && EventMachine.reactor_thread.alive?

现在它在带有乘客的远程服务器上正常工作,但是当我用#34; rails s"在本地启动时,服务器立即停止:

=> Booting Thin
=> Rails 4.2.1 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
"Starting resque-web against Resque server - 127.0.0.1:6379"
Thin web server (v1.6.3 codename Protein Powder)
Maximum connections set to 1024
Listening on localhost:3000, CTRL+C to stop
Exiting

我该如何解决这个问题? 我的Gemfile:

source 'https://rubygems.org'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.1'
gem 'coffee-rails', '~> 4.0.0'

# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'

gem 'jbuilder', '~> 2.0'

gem 'money'
gem 'google_currency'
gem 'resque'
gem 'resque-scheduler'
gem 'resque-web', require: 'resque_web'
gem 'unread'
gem 'geocoder'
gem 'i18n_data'
gem 'yandex-translator'

# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring

group :development do
  gem 'capistrano', '~> 3.0.1'
  gem 'capistrano-bundler'
  gem 'capistrano-rails', '~> 1.1.0'
  gem 'capistrano-rails-console'
  gem 'capistrano-rvm', '~> 0.1.1'

  gem 'spring'
  gem "awesome_print"
  gem 'pry'
  gem 'pry-remote'
  gem 'pry-rails'
  gem 'pry-stack_explorer'
  gem 'pry-byebug'
  gem 'quiet_assets'
  gem 'bullet'
end

gem 'factory_girl_rails'
gem 'faker'

gem 'pg'
gem 'redis'
gem 'redis-rails'
gem 'hiredis'
gem 'easy_translate'

gem 'russian'
gem "i18n-js"
gem 'slim'
gem 'slim-rails'
gem 'therubyracer'
gem 'less-rails'
gem 'rmagick'
gem 'carrierwave'
gem 'devise'
gem 'gon'
gem 'rmagick'
gem 'carrierwave'
gem "squeel"
gem 'mysql2',          '~> 0.3.13', :platform => :ruby
gem 'thinking-sphinx', '~> 3.1.0'
gem "websocket-rails"
gem 'aasm'

1 个答案:

答案 0 :(得分:0)

确保您已在远程服务器中打开端口6379