Class: Glottis::Handlers::RemoteInputHandler
- Inherits:
-
Object
- Object
- Glottis::Handlers::RemoteInputHandler
- Defined in:
- lib/glottis/handlers/remote_input_handler.rb
Overview
Manages stream input from the remote valyx server.
Constant Summary collapse
- PROTOCOL =
'http'- STREAM_DELIMITER =
"\0"- READ_TIMEOUT =
3600- REMOTE_PATHS =
{ get_message_stream: '/api/v1/messages/stream', legacy_message_stream: '/api/messages/stream' }.freeze
Instance Method Summary collapse
- #cleanup ⇒ Object
-
#initialize(incoming, host, port, cookie = nil) ⇒ RemoteInputHandler
constructor
A new instance of RemoteInputHandler.
- #join ⇒ Object
- #start ⇒ Object
Constructor Details
#initialize(incoming, host, port, cookie = nil) ⇒ RemoteInputHandler
Returns a new instance of RemoteInputHandler.
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/glottis/handlers/remote_input_handler.rb', line 20 def initialize(incoming, host, port, = nil) @incoming = incoming @host = host @port = port @cookie = @running = false @thread = nil @buffer = String.new setup_http end |
Instance Method Details
#cleanup ⇒ Object
44 45 46 47 48 |
# File 'lib/glottis/handlers/remote_input_handler.rb', line 44 def cleanup @running = false @http.finish if @http.started? @thread&.kill if @thread&.alive? end |
#join ⇒ Object
40 41 42 |
# File 'lib/glottis/handlers/remote_input_handler.rb', line 40 def join @thread&.join end |
#start ⇒ Object
31 32 33 34 35 36 37 38 |
# File 'lib/glottis/handlers/remote_input_handler.rb', line 31 def start @running = true @thread = Thread.new do @http.start read_loop end self end |