Class: Tunnels::HttpClient
- Inherits:
-
EventMachine::Connection
- Object
- EventMachine::Connection
- Tunnels::HttpClient
- Defined in:
- lib/tunnels.rb
Instance Attribute Summary collapse
-
#proxy ⇒ Object
readonly
Returns the value of attribute proxy.
Instance Method Summary collapse
- #connection_completed ⇒ Object
-
#initialize(proxy) ⇒ HttpClient
constructor
A new instance of HttpClient.
- #receive_data(data) ⇒ Object
- #send(data) ⇒ Object
- #unbind ⇒ Object
Constructor Details
#initialize(proxy) ⇒ HttpClient
Returns a new instance of HttpClient.
35 36 37 38 |
# File 'lib/tunnels.rb', line 35 def initialize(proxy) @proxy = proxy @connected = EventMachine::DefaultDeferrable.new end |
Instance Attribute Details
#proxy ⇒ Object (readonly)
Returns the value of attribute proxy.
33 34 35 |
# File 'lib/tunnels.rb', line 33 def proxy @proxy end |
Instance Method Details
#connection_completed ⇒ Object
40 41 42 |
# File 'lib/tunnels.rb', line 40 def connection_completed @connected.succeed end |
#receive_data(data) ⇒ Object
44 45 46 |
# File 'lib/tunnels.rb', line 44 def receive_data(data) proxy.relay_from_client(data) end |
#send(data) ⇒ Object
48 49 50 |
# File 'lib/tunnels.rb', line 48 def send(data) @connected.callback { send_data data } end |
#unbind ⇒ Object
52 53 54 |
# File 'lib/tunnels.rb', line 52 def unbind proxy.unbind_client end |