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
53
54
55
56
57
|
# File 'lib/slack/real_time/concurrency/eventmachine.rb', line 53
def disconnect!
super
EventMachine.stop_event_loop if EventMachine.reactor_running?
@thread = nil
end
|
#restart_async(client, new_url) ⇒ Object
43
44
45
46
47
48
49
50
51
|
# File 'lib/slack/real_time/concurrency/eventmachine.rb', line 43
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
59
60
61
62
|
# File 'lib/slack/real_time/concurrency/eventmachine.rb', line 59
def send_data(message)
logger.debug("#{self.class}##{__method__}") { message }
driver.send(message)
end
|
#start_async(client) ⇒ Object
29
30
31
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/slack/real_time/concurrency/eventmachine.rb', line 29
def start_async(client)
@thread = ensure_reactor_running
if client.run_ping?
EventMachine.add_periodic_timer(client.websocket_ping) do
client.run_ping!
end
end
client.run_loop
@thread
end
|