class Qpid::Proton::Listener::Handler

Class that handles listener events and provides options for accepted connections. This class simply returns a fixed set of options for every connection accepted, but you can subclass and override all of the on_ methods to provide more interesting behaviour.

Note: If a {Listener} method raises an exception, it will stop the {Container} that the handler is running in. See {Container#run}

Public Class Methods

new(opts=nil) click to toggle source

@param opts [Hash] Options to return from on_accept.

# File lib/core/listener.rb, line 37
def initialize(opts=nil) @opts = opts || {}; end

Public Instance Methods

on_accept(listener) click to toggle source

Called when a listener accepts a new connection. @param listener [Listener] The listener @return [Hash] Options to apply to the incoming connection, see {#connect}

# File lib/core/listener.rb, line 53
def on_accept(listener) @opts; end
on_close(listener) click to toggle source

Called when the listener closes. @param listener [Listener] The listener accepting the connection.

# File lib/core/listener.rb, line 57
def on_close(listener) end
on_error(listener, what) click to toggle source

Called if an error occurs. If there is an error while opening the listener, this method is called and {#on_open} is not @param listener [Listener] @param what [Condition] Information about the error.

# File lib/core/listener.rb, line 48
def on_error(listener, what) end
on_open(listener) click to toggle source

Called when the listener is ready to accept connections. @param listener [Listener] The listener

# File lib/core/listener.rb, line 41
def on_open(listener) end