Module: Raktr::Connection::Callbacks

Included in:
Raktr::Connection
Defined in:
lib/raktr/connection/callbacks.rb

Overview

Callbacks to be invoked per event.

Instance Method Summary collapse

Instance Method Details

#on_attachObject

This method is abstract.

Called after the connection has been attached to a Raktr::Connection#raktr.



26
27
# File 'lib/raktr/connection/callbacks.rb', line 26

def on_attach
end

#on_close(reason) ⇒ Object

This method is abstract.
Note:

If a connection could not be established no Raktr::Connection#socket may be available.

Called when the connection gets closed.

Parameters:

  • reason (Exception)

    Reason for the close.



44
45
# File 'lib/raktr/connection/callbacks.rb', line 44

def on_close( reason )
end

#on_connectObject

This method is abstract.

Called after the connection has been established.



20
21
# File 'lib/raktr/connection/callbacks.rb', line 20

def on_connect
end

#on_detachObject

This method is abstract.

Called right the connection is detached from the Raktr::Connection#raktr.



32
33
# File 'lib/raktr/connection/callbacks.rb', line 32

def on_detach
end

#on_flushObject

This method is abstract.

Called after the buffered data have all been sent to the peer.



65
66
# File 'lib/raktr/connection/callbacks.rb', line 65

def on_flush
end

#on_read(data) ⇒ Object

This method is abstract.

Called when data are available.

Parameters:

  • data (String)

    Incoming data.



53
54
# File 'lib/raktr/connection/callbacks.rb', line 53

def on_read( data )
end

#on_writeObject

This method is abstract.

Called after each Raktr::Connection#write call.



59
60
# File 'lib/raktr/connection/callbacks.rb', line 59

def on_write
end