Class: Glottis::Handlers::RemoteOutputHandler
- Inherits:
-
Object
- Object
- Glottis::Handlers::RemoteOutputHandler
- Defined in:
- lib/glottis/handlers/remote_output_handler.rb
Overview
Manages posting outgoing messages to the remote valyx server.
Constant Summary collapse
- POLL_INTERVAL =
0.1- PROTOCOL =
'http'- REMOTE_PATHS =
{ get_session: '/api/v1/session', legacy_session: '/api/session', post_message: '/api/v1/messages', legacy_post_message: '/api/message' }.freeze
Instance Attribute Summary collapse
-
#cookie ⇒ Object
readonly
Returns the value of attribute cookie.
-
#sid ⇒ Object
readonly
Returns the value of attribute sid.
Instance Method Summary collapse
- #cleanup ⇒ Object
-
#initialize(outgoing, host, port) ⇒ RemoteOutputHandler
constructor
A new instance of RemoteOutputHandler.
- #join ⇒ Object
- #start ⇒ Object
Constructor Details
#initialize(outgoing, host, port) ⇒ RemoteOutputHandler
Returns a new instance of RemoteOutputHandler.
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/glottis/handlers/remote_output_handler.rb', line 24 def initialize(outgoing, host, port) @outgoing = outgoing @host = host @port = port @running = false @thread = nil @sid = nil @cookie = nil setup_http end |
Instance Attribute Details
#cookie ⇒ Object (readonly)
Returns the value of attribute cookie.
22 23 24 |
# File 'lib/glottis/handlers/remote_output_handler.rb', line 22 def @cookie end |
#sid ⇒ Object (readonly)
Returns the value of attribute sid.
22 23 24 |
# File 'lib/glottis/handlers/remote_output_handler.rb', line 22 def sid @sid end |
Instance Method Details
#cleanup ⇒ Object
50 51 52 53 54 |
# File 'lib/glottis/handlers/remote_output_handler.rb', line 50 def cleanup @running = false @http.finish if @http.started? @thread&.kill if @thread&.alive? end |
#join ⇒ Object
46 47 48 |
# File 'lib/glottis/handlers/remote_output_handler.rb', line 46 def join @thread&.join end |
#start ⇒ Object
35 36 37 38 39 40 41 42 43 44 |
# File 'lib/glottis/handlers/remote_output_handler.rb', line 35 def start @running = true @thread = Thread.new do @http.start request_session send_queued while @running end self end |