Sha256: af0b51718efc3296c381438fe3f33966c70d08851a60e197429b0d15f0ebec2e

Contents?: true

Size: 1.31 KB

Versions: 3

Compression:

Stored size: 1.31 KB

Contents

=begin

    This file is part of the Raktr project and may be subject to
    redistribution and commercial restrictions. Please see the Raktr
    web site for more information on licensing and terms of use.

=end

class Raktr
class Connection

# Callbacks to be invoked per event.
#
# @author Tasos "Zapotek" Laskos <tasos.laskos@gmail.com>
module Callbacks

    # Called after the connection has been established.
    #
    # @abstract
    def on_connect
    end

    # Called after the connection has been attached to a {#raktr}.
    #
    # @abstract
    def on_attach
    end

    # Called right the connection is detached from the {#raktr}.
    #
    # @abstract
    def on_detach
    end

    # @note If a connection could not be established no {#socket} may be
    #   available.
    #
    # Called when the connection gets closed.
    #
    # @param    [Exception] reason
    #   Reason for the close.
    #
    # @abstract
    def on_close( reason )
    end

    # Called when data are available.
    #
    # @param    [String] data
    #   Incoming data.
    #
    # @abstract
    def on_read( data )
    end

    # Called after each {#write} call.
    #
    # @abstract
    def on_write
    end

    # Called after the {#write buffered data} have all been sent to the peer.
    #
    # @abstract
    def on_flush
    end

end

end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
raktr-0.0.3 lib/raktr/connection/callbacks.rb
raktr-0.0.2 lib/raktr/connection/callbacks.rb
raktr-0.0.1 lib/raktr/connection/callbacks.rb