Ruby on Rails
Thursday, March 29, 2012
When you enter a eventmachine block it never return control to your app. You have to turn it on but dont stay inside the evented block.
Use this method before initializing comunication to faye
def self.ensure_reactor_running
Thread.new { EM.run } unless EM.reactor_running?
sleep 0.1 until EM.reactor_running?
end
this will start eventmachine in a thread that is not the one your rails app is running if not already running.
this will start eventmachine in a thread that is not the one your rails app is running if not already running.
Just call
ensure_reactor_running
ensure_reactor_running
before subscribing
-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment