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.
542 543 544 545 546 |
# File 'lib/avro/ipc.rb', line 542 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.
541 542 543 |
# File 'lib/avro/ipc.rb', line 541 def host @host end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
541 542 543 |
# File 'lib/avro/ipc.rb', line 541 def port @port end |
#remote_name ⇒ Object (readonly)
Returns the value of attribute remote_name.
541 542 543 |
# File 'lib/avro/ipc.rb', line 541 def remote_name @remote_name end |
Instance Method Details
#transceive(message) ⇒ Object
548 549 550 551 552 553 |
# File 'lib/avro/ipc.rb', line 548 def transceive() writer = FramedWriter.new(StringIO.new(String.new('', encoding: 'BINARY'))) writer.() resp = @conn.post('/', writer.to_s, {'Content-Type' => 'avro/binary'}) FramedReader.new(StringIO.new(resp.body)). end |