Class: FWC::TraceConnection

Inherits:
EM::Connection
  • Object
show all
Includes:
EM::Protocols::LineText2
Defined in:
lib/fwc.rb

Instance Method Summary collapse

Constructor Details

#initialize(instances) ⇒ TraceConnection

Returns a new instance of TraceConnection.



38
39
40
# File 'lib/fwc.rb', line 38

def initialize instances
  @instances = instances
end

Instance Method Details

#receive_line(line) ⇒ Object



47
48
49
50
51
52
53
# File 'lib/fwc.rb', line 47

def receive_line line
  data = JSON.load line

  @instances.each do |instance|
    instance.receive data
  end
end

#unbindObject



42
43
44
45
# File 'lib/fwc.rb', line 42

def unbind
  FWC.log.error "Connection lost"
  EM.stop
end