Module: Revent::RRClient
- Defined in:
- lib/revent/r_r.rb
Overview
To make your class a client, just include Revent::RRClient in it.
The client has the following methods:
-
connect
-
on_connect
-
on_unbind
-
on_message
For more control, it uses “con” directly.
Instance Attribute Summary collapse
-
#con ⇒ Object
readonly
Returns the value of attribute con.
Instance Method Summary collapse
- #connect(host, port) ⇒ Object
- #on_connect ⇒ Object
- #on_message(message) ⇒ Object
- #on_unbind ⇒ Object
Instance Attribute Details
#con ⇒ Object (readonly)
Returns the value of attribute con.
115 116 117 |
# File 'lib/revent/r_r.rb', line 115 def con @con end |
Instance Method Details
#connect(host, port) ⇒ Object
117 118 119 120 121 122 123 124 |
# File 'lib/revent/r_r.rb', line 117 def connect(host, port) EventMachine::connect(host, port, RRCon) do |con| # con is an instance of a class that has included RRCon con.user = self @con = con on_connect end end |
#on_connect ⇒ Object
126 127 |
# File 'lib/revent/r_r.rb', line 126 def on_connect end |
#on_message(message) ⇒ Object
132 133 |
# File 'lib/revent/r_r.rb', line 132 def () end |
#on_unbind ⇒ Object
129 130 |
# File 'lib/revent/r_r.rb', line 129 def on_unbind end |