Class: OnStomp::Connections::Stomp_1_1
- Inherits:
-
Base
- Object
- Base
- OnStomp::Connections::Stomp_1_1
- Includes:
- Heartbeating, Stomp_1
- Defined in:
- lib/onstomp/connections/stomp_1_1.rb
Overview
A STOMP 1.1 specific connection
Constant Summary
Constants inherited from Base
MAX_BYTES_PER_READ, MAX_BYTES_PER_WRITE
Instance Attribute Summary (collapse)
Attributes included from Heartbeating
Attributes inherited from Base
client, last_received_at, last_transmitted_at, read_timeout, socket, version, write_timeout
Instance Method Summary (collapse)
-
- (OnStomp::Components::Frame) ack_frame(*args)
Creates an ACK frame.
-
- (Object) configure(connected, con_cbs)
Calls Base#configure then configures heartbeating parameters.
-
- (Boolean) connected?
Returns true if Base#connected? is true and we have a Heartbeating#pulse?.
-
- (OnStomp::Components::Frame) heartbeat_frame
Creates a heartbeat frame (serialized as a single "\n" character).
-
- (Stomp_1_1) initialize(socket, client)
constructor
Calls Base#initialize and creates a STOMP 1.0 serializer.
-
- (OnStomp::Components::Frame) nack_frame(*args)
Creates an NACK frame.
-
- (OnStomp::Components::Frame) subscribe_frame(d, h)
Creates a SUBSCRIBE frame.
Methods included from Heartbeating
#broker_pulse?, #client_pulse?, #configure_heartbeating, #heartbeat_broker_limit, #heartbeat_client_limit, #pulse?
Methods included from Stomp_1
#abort_frame, #begin_frame, #commit_frame, #connect_frame, #disconnect_frame, #send_frame, #unsubscribe_frame
Methods inherited from Base
#close, #connect, #duration_since_received, #duration_since_transmitted, #flush_write_buffer, #io_process, #io_process_read, #io_process_write, #method_missing, #push_write_buffer, #shift_write_buffer, #unshift_write_buffer, #write_frame_nonblock
Methods included from Interfaces::ConnectionEvents
#blocked, #closed, #died, #established, #install_bindings_from_client, #on_blocked, #on_closed, #on_died, #on_established, #on_terminated, #terminated, #trigger_connection_event
Methods included from Interfaces::EventManager
#bind_event, #event_callbacks, included, #trigger_event
Constructor Details
- (Stomp_1_1) initialize(socket, client)
Calls Base#initialize and creates a STOMP 1.0 serializer
14 15 16 17 |
# File 'lib/onstomp/connections/stomp_1_1.rb', line 14 def initialize socket, client super @serializer = OnStomp::Connections::Serializers::Stomp_1_1.new end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class OnStomp::Connections::Base
Instance Attribute Details
- (OnStomp::Connections::Serializers::Stomp_1_1) serializer (readonly)
10 11 12 |
# File 'lib/onstomp/connections/stomp_1_1.rb', line 10 def serializer @serializer end |
Instance Method Details
- (OnStomp::Components::Frame) ack_frame(*args)
Creates an ACK frame
44 45 46 |
# File 'lib/onstomp/connections/stomp_1_1.rb', line 44 def ack_frame *args create_ack_or_nack 'ACK', args end |
- (Object) configure(connected, con_cbs)
Calls Base#configure then configures heartbeating parameters.
23 24 25 26 |
# File 'lib/onstomp/connections/stomp_1_1.rb', line 23 def configure connected, con_cbs super configure_heartbeating client.heartbeats, connected.heart_beat end |
- (Boolean) connected?
Returns true if Base#connected? is true and we have a Heartbeating#pulse?
30 31 32 |
# File 'lib/onstomp/connections/stomp_1_1.rb', line 30 def connected? super && pulse? end |
- (OnStomp::Components::Frame) heartbeat_frame
Creates a heartbeat frame (serialized as a single "\n" character)
56 57 58 |
# File 'lib/onstomp/connections/stomp_1_1.rb', line 56 def heartbeat_frame OnStomp::Components::Frame.new end |
- (OnStomp::Components::Frame) nack_frame(*args)
Creates an NACK frame
50 51 52 |
# File 'lib/onstomp/connections/stomp_1_1.rb', line 50 def nack_frame *args create_ack_or_nack 'NACK', args end |
- (OnStomp::Components::Frame) subscribe_frame(d, h)
Creates a SUBSCRIBE frame. Sets ack
header to 'auto' unless it is
already set to 'client' or 'client-individual'.
37 38 39 40 |
# File 'lib/onstomp/connections/stomp_1_1.rb', line 37 def subscribe_frame d, h h[:ack] = 'auto' unless ['client', 'client-individual'].include?(h[:ack]) create_frame 'SUBSCRIBE', [{:id => OnStomp.next_serial}, h, {:destination => d}] end |