Class: EMRPC::ReconnectingClient
- Inherits:
-
Object
- Object
- EMRPC::ReconnectingClient
- Defined in:
- lib/emrpc/reconnecting_client.rb
Overview
Reconnects when needed.
Defined Under Namespace
Modules: ReconnectingCallbacks
Instance Attribute Summary collapse
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
-
#protocol ⇒ Object
readonly
Returns the value of attribute protocol.
Instance Method Summary collapse
- #close_connection(after_writing = false) ⇒ Object
- #connection ⇒ Object
-
#initialize(options) ⇒ ReconnectingClient
constructor
A new instance of ReconnectingClient.
- #send_data(data) ⇒ Object
Constructor Details
#initialize(options) ⇒ ReconnectingClient
Returns a new instance of ReconnectingClient.
5 6 7 8 9 10 11 12 |
# File 'lib/emrpc/reconnecting_client.rb', line 5 def initialize() @host = [:host] @port = [:port] @protocol = [:protocol] @timeout = [:timeout] @connection = nil # diconnected at the start end |
Instance Attribute Details
#host ⇒ Object (readonly)
Returns the value of attribute host.
4 5 6 |
# File 'lib/emrpc/reconnecting_client.rb', line 4 def host @host end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
4 5 6 |
# File 'lib/emrpc/reconnecting_client.rb', line 4 def port @port end |
#protocol ⇒ Object (readonly)
Returns the value of attribute protocol.
4 5 6 |
# File 'lib/emrpc/reconnecting_client.rb', line 4 def protocol @protocol end |
Instance Method Details
#close_connection(after_writing = false) ⇒ Object
23 24 25 |
# File 'lib/emrpc/reconnecting_client.rb', line 23 def close_connection(after_writing = false) end |
#connection ⇒ Object
14 15 16 17 |
# File 'lib/emrpc/reconnecting_client.rb', line 14 def connection return @connection if @connection end |
#send_data(data) ⇒ Object
19 20 21 |
# File 'lib/emrpc/reconnecting_client.rb', line 19 def send_data(data) connection.send_data end |