Class: Qpid::Proton::Listener::Handler
- Inherits:
-
Object
- Object
- Qpid::Proton::Listener::Handler
- Defined in:
- lib/core/listener.rb
Overview
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 Qpid::Proton::Listener method raises an exception, it will stop the Container that the handler is running in. See Container#run
Instance Method Summary collapse
-
#initialize(opts = nil) ⇒ Handler
constructor
A new instance of Handler.
-
#on_accept(listener) ⇒ Hash
Called when a listener accepts a new connection.
-
#on_close(listener)
Called when the listener closes.
-
#on_error(listener, what)
Called if an error occurs.
-
#on_open(listener)
Called when the listener is ready to accept connections.
Constructor Details
#initialize(opts = nil) ⇒ Handler
Returns a new instance of Handler.
37 |
# File 'lib/core/listener.rb', line 37 def initialize(opts=nil) @opts = opts || {}; end |
Instance Method Details
#on_accept(listener) ⇒ Hash
Called when a listener accepts a new connection.
53 |
# File 'lib/core/listener.rb', line 53 def on_accept(listener) @opts; end |
#on_close(listener)
Called when the listener closes.
57 |
# File 'lib/core/listener.rb', line 57 def on_close(listener) end |
#on_error(listener, what)
Called if an error occurs. If there is an error while opening the listener, this method is called and #on_open is not
48 |
# File 'lib/core/listener.rb', line 48 def on_error(listener, what) end |
#on_open(listener)
Called when the listener is ready to accept connections.
41 |
# File 'lib/core/listener.rb', line 41 def on_open(listener) end |