Module: OnStomp::Interfaces::ConnectionEvents
- Includes:
- EventManager
- Included in:
- Connections::Base
- Defined in:
- lib/onstomp/interfaces/connection_events.rb
Overview
Mixin for connection events
Connection State Events (collapse)
-
- (Object) blocked {|client, connection| ... }
Binds a callback to be invoked when a connection has been blocked on writing for more than the allowed duration, closing the connection.
-
- (Object) closed {|client, connection| ... }
Binds a callback to be invoked when a connection has been closed, either through a graceful disconnect or unexpectedly.
-
- (Object) died {|client, connection| ... }
Binds a callback to be invoked when a connection has been died due to insufficient data transfer.
-
- (Object) established {|client, connection| ... }
Binds a callback to be invoked when a connection has been fully established between broker and client.
-
- (Object) on_blocked {|client, connection| ... }
Binds a callback to be invoked when a connection has been blocked on writing for more than the allowed duration, closing the connection.
-
- (Object) on_closed {|client, connection| ... }
Binds a callback to be invoked when a connection has been closed, either through a graceful disconnect or unexpectedly.
-
- (Object) on_died {|client, connection| ... }
Binds a callback to be invoked when a connection has been died due to insufficient data transfer.
-
- (Object) on_established {|client, connection| ... }
Binds a callback to be invoked when a connection has been fully established between broker and client.
-
- (Object) on_terminated {|client, connection| ... }
Binds a callback to be invoked when a connection has been terminated (eg: closed unexpectedly due to an exception).
-
- (Object) terminated {|client, connection| ... }
Binds a callback to be invoked when a connection has been terminated (eg: closed unexpectedly due to an exception).
Instance Method Summary (collapse)
-
- (Object) install_bindings_from_client(ev_hash)
Takes a hash of event bindings a client has stored and binds them to this connection, then triggers
on_established
. -
- (Object) trigger_connection_event(event, msg = '')
Triggers a connection specific event.
Methods included from EventManager
#bind_event, #event_callbacks, included, #trigger_event
Instance Method Details
- (Object) blocked {|client, connection| ... }
Binds a callback to be invoked when a connection has been blocked on writing for more than the allowed duration, closing the connection.
41 |
# File 'lib/onstomp/interfaces/connection_events.rb', line 41 create_event_methods :blocked, :on |
- (Object) closed {|client, connection| ... }
If connection is closed unexpectedly, #on_died is triggered first,
Binds a callback to be invoked when a connection has been closed, either through a graceful disconnect or unexpectedly. followed by this event.
51 |
# File 'lib/onstomp/interfaces/connection_events.rb', line 51 create_event_methods :closed, :on |
- (Object) died {|client, connection| ... }
Only applies to STOMP 1.1 connections with heartbeating enabled.
Binds a callback to be invoked when a connection has been died due to insufficient data transfer.
25 |
# File 'lib/onstomp/interfaces/connection_events.rb', line 25 create_event_methods :died, :on |
- (Object) established {|client, connection| ... }
Binds a callback to be invoked when a connection has been fully established between broker and client.
16 |
# File 'lib/onstomp/interfaces/connection_events.rb', line 16 create_event_methods :established, :on |
- (Object) install_bindings_from_client(ev_hash)
Takes a hash of event bindings a client has stored
and binds them to this connection, then triggers on_established
.
This allows users to add callbacks for
connection events before the connection exist and have said callbacks
installed once the connection is created.
68 69 70 71 72 73 |
# File 'lib/onstomp/interfaces/connection_events.rb', line 68 def install_bindings_from_client ev_hash ev_hash.each do |ev, cbs| cbs.each { |cb| bind_event(ev, cb) } end trigger_connection_event :established, "STOMP #{self.version} connection negotiated" end |
- (Object) on_blocked {|client, connection| ... }
Binds a callback to be invoked when a connection has been blocked on writing for more than the allowed duration, closing the connection.
41 |
# File 'lib/onstomp/interfaces/connection_events.rb', line 41 create_event_methods :blocked, :on |
- (Object) on_closed {|client, connection| ... }
If connection is closed unexpectedly, #on_died is triggered first,
Binds a callback to be invoked when a connection has been closed, either through a graceful disconnect or unexpectedly. followed by this event.
51 |
# File 'lib/onstomp/interfaces/connection_events.rb', line 51 create_event_methods :closed, :on |
- (Object) on_died {|client, connection| ... }
Only applies to STOMP 1.1 connections with heartbeating enabled.
Binds a callback to be invoked when a connection has been died due to insufficient data transfer.
25 |
# File 'lib/onstomp/interfaces/connection_events.rb', line 25 create_event_methods :died, :on |
- (Object) on_established {|client, connection| ... }
Binds a callback to be invoked when a connection has been fully established between broker and client.
16 |
# File 'lib/onstomp/interfaces/connection_events.rb', line 16 create_event_methods :established, :on |
- (Object) on_terminated {|client, connection| ... }
Binds a callback to be invoked when a connection has been terminated (eg: closed unexpectedly due to an exception)
33 |
# File 'lib/onstomp/interfaces/connection_events.rb', line 33 create_event_methods :terminated, :on |
- (Object) terminated {|client, connection| ... }
Binds a callback to be invoked when a connection has been terminated (eg: closed unexpectedly due to an exception)
33 |
# File 'lib/onstomp/interfaces/connection_events.rb', line 33 create_event_methods :terminated, :on |
- (Object) trigger_connection_event(event, msg = '')
Triggers a connection specific event.
57 58 59 |
# File 'lib/onstomp/interfaces/connection_events.rb', line 57 def trigger_connection_event event, msg='' trigger_event :on_#{event}", self.client, self, msg end |