Class: Racoon::Firehose
- Inherits:
-
Object
- Object
- Racoon::Firehose
- Defined in:
- lib/racoon/firehose.rb
Instance Attribute Summary collapse
-
#connections ⇒ Object
Returns the value of attribute connections.
-
#error_callback ⇒ Object
Returns the value of attribute error_callback.
-
#feedback_callback ⇒ Object
Returns the value of attribute feedback_callback.
Instance Method Summary collapse
-
#initialize(reactor, address = ZM::Address.new('*', 11555, :tcp), &feedback_callback) ⇒ Firehose
constructor
A new instance of Firehose.
- #on_attach(socket) ⇒ Object
- #on_readable(socket, messages) ⇒ Object
Constructor Details
#initialize(reactor, address = ZM::Address.new('*', 11555, :tcp), &feedback_callback) ⇒ Firehose
Returns a new instance of Firehose.
15 16 17 18 19 20 21 |
# File 'lib/racoon/firehose.rb', line 15 def initialize(reactor, address = ZM::Address.new('*', 11555, :tcp), &feedback_callback) @connections = {} @reactor = reactor @address = address @feedback_callback = feedback_callback @error_callback = nil end |
Instance Attribute Details
#connections ⇒ Object
Returns the value of attribute connections.
13 14 15 |
# File 'lib/racoon/firehose.rb', line 13 def connections @connections end |
#error_callback ⇒ Object
Returns the value of attribute error_callback.
13 14 15 |
# File 'lib/racoon/firehose.rb', line 13 def error_callback @error_callback end |
#feedback_callback ⇒ Object
Returns the value of attribute feedback_callback.
13 14 15 |
# File 'lib/racoon/firehose.rb', line 13 def feedback_callback @feedback_callback end |
Instance Method Details
#on_attach(socket) ⇒ Object
23 24 25 |
# File 'lib/racoon/firehose.rb', line 23 def on_attach(socket) socket.bind(@address) end |
#on_readable(socket, messages) ⇒ Object
27 28 29 30 31 32 |
# File 'lib/racoon/firehose.rb', line 27 def on_readable(socket, ) .each do || packet = YAML::load(.copy_out_string) apns(packet[:project], packet[:bytes]) end end |