Class: Tunnelss::HttpClient
- Inherits:
-
EventMachine::Connection
- Object
- EventMachine::Connection
- Tunnelss::HttpClient
- Defined in:
- lib/tunnelss.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.
58 59 60 61 |
# File 'lib/tunnelss.rb', line 58 def initialize(proxy) @proxy = proxy @connected = EventMachine::DefaultDeferrable.new end |
Instance Attribute Details
#proxy ⇒ Object (readonly)
Returns the value of attribute proxy.
56 57 58 |
# File 'lib/tunnelss.rb', line 56 def proxy @proxy end |
Instance Method Details
#connection_completed ⇒ Object
63 64 65 |
# File 'lib/tunnelss.rb', line 63 def connection_completed @connected.succeed end |
#receive_data(data) ⇒ Object
67 68 69 |
# File 'lib/tunnelss.rb', line 67 def receive_data(data) proxy.relay_from_client(data) end |
#send(data) ⇒ Object
71 72 73 |
# File 'lib/tunnelss.rb', line 71 def send(data) @connected.callback { send_data data } end |
#unbind ⇒ Object
75 76 77 |
# File 'lib/tunnelss.rb', line 75 def unbind proxy.unbind_client end |