Class: Slack::RealTime::Concurrency::Eventmachine::Socket
- Inherits:
-
Socket
- Object
- Socket
- Slack::RealTime::Concurrency::Eventmachine::Socket
show all
- Defined in:
- lib/slack/real_time/concurrency/eventmachine.rb
Instance Attribute Summary
Attributes inherited from Socket
#driver, #options, #url
Instance Method Summary
collapse
Methods inherited from Socket
#close, #connect!, #connected?, #current_time, #initialize, #start_sync, #time_since_last_message
Instance Method Details
#disconnect! ⇒ Object
56
57
58
59
60
|
# File 'lib/slack/real_time/concurrency/eventmachine.rb', line 56
def disconnect!
super
EventMachine.stop_event_loop if EventMachine.reactor_running?
@thread = nil
end
|
#restart_async(client, new_url) ⇒ Object
46
47
48
49
50
51
52
53
54
|
# File 'lib/slack/real_time/concurrency/eventmachine.rb', line 46
def restart_async(client, new_url)
@url = new_url
@last_message_at = current_time
@thread = ensure_reactor_running
client.run_loop
@thread
end
|
#send_data(message) ⇒ Object
62
63
64
65
|
# File 'lib/slack/real_time/concurrency/eventmachine.rb', line 62
def send_data(message)
logger.debug("#{self.class}##{__method__}") { message }
driver.send(message)
end
|
#start_async(client) ⇒ Object
32
33
34
35
36
37
38
39
40
41
42
43
44
|
# File 'lib/slack/real_time/concurrency/eventmachine.rb', line 32
def start_async(client)
@thread = ensure_reactor_running
if client.run_ping?
EventMachine.add_periodic_timer client.websocket_ping_timer do
client.run_ping!
end
end
client.run_loop
@thread
end
|