Class: Avro::IPC::HTTPTransceiver
- Inherits:
-
Object
- Object
- Avro::IPC::HTTPTransceiver
- Defined in:
- lib/avro/ipc.rb
Overview
Only works for clients. Sigh.
Instance Attribute Summary collapse
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
-
#remote_name ⇒ Object
readonly
Returns the value of attribute remote_name.
Instance Method Summary collapse
-
#initialize(host, port) ⇒ HTTPTransceiver
constructor
A new instance of HTTPTransceiver.
- #transceive(message) ⇒ Object
Constructor Details
#initialize(host, port) ⇒ HTTPTransceiver
Returns a new instance of HTTPTransceiver.
538 539 540 541 542 |
# File 'lib/avro/ipc.rb', line 538 def initialize(host, port) @host, @port = host, port @remote_name = "#{host}:#{port}" @conn = Net::HTTP.start host, port end |
Instance Attribute Details
#host ⇒ Object (readonly)
Returns the value of attribute host.
537 538 539 |
# File 'lib/avro/ipc.rb', line 537 def host @host end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
537 538 539 |
# File 'lib/avro/ipc.rb', line 537 def port @port end |
#remote_name ⇒ Object (readonly)
Returns the value of attribute remote_name.
537 538 539 |
# File 'lib/avro/ipc.rb', line 537 def remote_name @remote_name end |
Instance Method Details
#transceive(message) ⇒ Object
544 545 546 547 548 549 |
# File 'lib/avro/ipc.rb', line 544 def transceive() writer = FramedWriter.new(StringIO.new(''.force_encoding('BINARY'))) writer.() resp = @conn.post('/', writer.to_s, {'Content-Type' => 'avro/binary'}) FramedReader.new(StringIO.new(resp.body)). end |