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.
@param opts [Hash] Options to return from on_accept.
# File lib/core/listener.rb, line 34 def initialize(opts=nil) @opts = opts || {}; end
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 50 def on_accept(listener) @opts; end
Called when the listener closes. @param listener [Listener] The listener accepting the connection.
# File lib/core/listener.rb, line 54 def on_close(listener) end
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 45 def on_error(listener, what) end
Called when the listener is ready to accept connections. @param listener [Listener] The listener
# File lib/core/listener.rb, line 38 def on_open(listener) end