Class: Nervion::Client
- Inherits:
-
Object
- Object
- Nervion::Client
- Defined in:
- lib/nervion/client.rb
Instance Method Summary collapse
- #close_stream ⇒ Object
-
#initialize(host, port) ⇒ Client
constructor
A new instance of Client.
- #stop ⇒ Object
- #stream(request, callbacks) ⇒ Object
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_stream ⇒ Object
21 22 23 |
# File 'lib/nervion/client.rb', line 21 def close_stream @stream.close end |
#stop ⇒ Object
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 |