Class: Wamp::Client::Transport::EventMachineBase
- Inherits:
-
Base
- Object
- Base
- Wamp::Client::Transport::EventMachineBase
show all
- Defined in:
- lib/wamp/client/transport/event_machine_base.rb
Instance Attribute Summary
Attributes inherited from Base
#connected, #headers, #protocol, #proxy, #serializer, #uri
Class Method Summary
collapse
Methods inherited from Base
#add_timer, #connect, #connected?, #disconnect, #initialize, #send_message
Methods included from Event
included
Class Method Details
.add_tick_loop(&block) ⇒ Object
26
27
28
|
# File 'lib/wamp/client/transport/event_machine_base.rb', line 26
def self.add_tick_loop(&block)
EM.tick_loop(&block)
end
|
.add_timer(milliseconds, &callback) ⇒ Object
19
20
21
22
23
24
|
# File 'lib/wamp/client/transport/event_machine_base.rb', line 19
def self.add_timer(milliseconds, &callback)
delay = (milliseconds.to_f/1000.0).ceil
EM.add_timer(delay) {
callback.call
}
end
|
.start_event_machine(&block) ⇒ Object
9
10
11
12
13
|
# File 'lib/wamp/client/transport/event_machine_base.rb', line 9
def self.start_event_machine(&block)
EM.run do
block.call
end
end
|
.stop_event_machine ⇒ Object
15
16
17
|
# File 'lib/wamp/client/transport/event_machine_base.rb', line 15
def self.stop_event_machine
EM.stop
end
|