Class: Glottis::Handlers::RemoteInputHandler

Inherits:
Thread
  • Object
show all
Defined in:
lib/glottis/handlers/remote_input_handler.rb

Overview

This class manages a TCP connection with a valyx server.

Constant Summary collapse

PROTOCOL =
'http'.freeze
STREAM_DELIMITER =
"\0".freeze
READ_TIMEOUT =

this needs to be high

3600
REMOTE_PATHS =
{
  get_message_stream: '/api/messages/stream'
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(incoming, host, port) ⇒ RemoteInputHandler

Returns a new instance of RemoteInputHandler.



17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/glottis/handlers/remote_input_handler.rb', line 17

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

  setup_http

  super do
    @http.start
    read_loop
  end
end

Instance Method Details

#cleanupObject



30
31
32
# File 'lib/glottis/handlers/remote_input_handler.rb', line 30

def cleanup
  @http.finish if @http.started?
end