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

Instance Method Summary collapse

Instance Attribute Details

#conObject (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_connectObject



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 on_message(message)
end

#on_unbindObject



129
130
# File 'lib/revent/r_r.rb', line 129

def on_unbind
end