Class: NFAgent::Event

Inherits:
EventMachine::Connection
  • Object
show all
Defined in:
lib/nfagent/event.rb

Instance Method Summary collapse

Constructor Details

#initialize(chunk_handler) ⇒ Event

Returns a new instance of Event.



3
4
5
# File 'lib/nfagent/event.rb', line 3

def initialize(chunk_handler)
  @handler = chunk_handler
end

Instance Method Details

#post_initObject



7
8
9
# File 'lib/nfagent/event.rb', line 7

def post_init
  Log.info "Client Connected"
end

#receive_data(data) ⇒ Object



11
12
13
14
15
16
# File 'lib/nfagent/event.rb', line 11

def receive_data(data)
  if data && data.length > 2
    @handler.submit(data)
  end
  send_data('OK')
end

#unbindObject



18
19
20
# File 'lib/nfagent/event.rb', line 18

def unbind
  Log.info "Disconnected"
end