Class: Slack::RealTime::Concurrency::Eventmachine::Socket

Inherits:
Socket
  • Object
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

#connect!, #connected?, #disconnect!, #initialize, #start_sync

Constructor Details

This class inherits a constructor from Slack::RealTime::Socket

Instance Method Details

#closeObject



37
38
39
40
41
# File 'lib/slack/real_time/concurrency/eventmachine.rb', line 37

def close
  super
  EventMachine.stop if @thread
  @thread = nil
end

#send_data(message) ⇒ Object



43
44
45
46
# File 'lib/slack/real_time/concurrency/eventmachine.rb', line 43

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
# File 'lib/slack/real_time/concurrency/eventmachine.rb', line 29

def start_async(client)
  @thread = ensure_reactor_running

  client.run_loop

  @thread
end