Class: ActionCable::Connection::FayeEventLoop

Inherits:
Object
  • Object
show all
Defined in:
lib/action_cable/connection/faye_event_loop.rb

Defined Under Namespace

Classes: EMTimer

Constant Summary collapse

@@mutex =
Mutex.new

Instance Method Summary collapse

Instance Method Details

#post(task = nil, &block) ⇒ Object



17
18
19
20
21
22
# File 'lib/action_cable/connection/faye_event_loop.rb', line 17

def post(task = nil, &block)
  task ||= block

  ensure_reactor_running
  ::EM.next_tick(&task)
end

#timer(interval, &block) ⇒ Object



12
13
14
15
# File 'lib/action_cable/connection/faye_event_loop.rb', line 12

def timer(interval, &block)
  ensure_reactor_running
  EMTimer.new(::EM::PeriodicTimer.new(interval, &block))
end