Class: Nervion::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/nervion/client.rb

Instance Method Summary collapse

Constructor Details

#initialize(host, port) ⇒ Client

Returns a new instance of Client.



6
7
8
9
# File 'lib/nervion/client.rb', line 6

def initialize(host, port)
  @host = host
  @port = port
end

Instance Method Details

#close_streamObject



21
22
23
# File 'lib/nervion/client.rb', line 21

def close_stream
  @stream.close
end

#stopObject



16
17
18
19
# File 'lib/nervion/client.rb', line 16

def stop
  close_stream
  EM.stop
end

#stream(request, callbacks) ⇒ Object



11
12
13
14
# File 'lib/nervion/client.rb', line 11

def stream(request, callbacks)
  handler = StreamHandler.new(callbacks)
  EM.run { @stream = EM.connect @host, @port, Stream, request, handler }
end