I am using Websocket Rails. On my local server it works correct(in production and development env). But when I deploy my app to remote server, I have an error when I have tried to connect:
RuntimeError (eventmachine not initialized: evma_install_oneshot_timer):
I find this solve Websockets not working in my Rails app when I run on Unicorn server, but works on a Thin server I write to config/initializers/eventmachine.rb this code:
Thread.new { EventMachine.run } unless EventMachine.reactor_running? && EventMachine.reactor_thread.alive?
Now It working correct on remote server with passenger, but when I start it local with "rails s", the server is stopped at once:
=> 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
How can I solve this problem? My 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'