Class: OnStomp::Connections::Stomp_1_0
- Includes:
- Stomp_1
- Defined in:
- lib/onstomp/connections/stomp_1_0.rb
Overview
A STOMP 1.0 specific connection
Constant Summary
Constants inherited from Base
Base::MAX_BYTES_PER_READ, Base::MAX_BYTES_PER_WRITE
Instance Attribute Summary collapse
Attributes inherited from Base
#client, #last_received_at, #last_transmitted_at, #socket, #version
Instance Method Summary collapse
-
#ack_frame(*args) ⇒ OnStomp::Components::Frame
Creates an ACK frame.
-
#initialize(socket, client) ⇒ Stomp_1_0
constructor
Calls Base#initialize and creates a STOMP 1.0 serializer.
-
#subscribe_frame(d, h) ⇒ OnStomp::Components::Frame
Creates a SUBSCRIBE frame.
Methods included from Stomp_1
#abort_frame, #begin_frame, #commit_frame, #connect_frame, #disconnect_frame, #send_frame, #unsubscribe_frame
Methods inherited from Base
#close, #configure, #connect, #connected?, #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
#install_bindings_from_client, #trigger_connection_event
Methods included from Interfaces::EventManager
#bind_event, #event_callbacks, included, #trigger_event
Constructor Details
#initialize(socket, client) ⇒ Stomp_1_0
Calls Base#initialize and creates a STOMP 1.0 serializer
13 14 15 16 |
# File 'lib/onstomp/connections/stomp_1_0.rb', line 13 def initialize socket, client super @serializer = OnStomp::Connections::Serializers::Stomp_1_0.new end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class OnStomp::Connections::Base
Instance Attribute Details
#serializer ⇒ OnStomp::Connections::Serializers::Stomp_1_0 (readonly)
9 10 11 |
# File 'lib/onstomp/connections/stomp_1_0.rb', line 9 def serializer @serializer end |
Instance Method Details
#ack_frame(*args) ⇒ OnStomp::Components::Frame
Creates an ACK frame
28 29 30 31 32 33 34 35 |
# File 'lib/onstomp/connections/stomp_1_0.rb', line 28 def ack_frame *args headers = args.last.is_a?(Hash) ? args.pop : {} m_id = args.shift m_id = m_id[:'message-id'] if m_id.is_a?(OnStomp::Components::Frame) create_frame('ACK', [{:'message-id' => m_id}, headers]).tap do |f| raise ArgumentError, 'no message-id to ACK' unless f.header?(:'message-id') end end |
#subscribe_frame(d, h) ⇒ OnStomp::Components::Frame
Creates a SUBSCRIBE frame. Sets ack
header to ‘auto’ unless it is already set to ‘client’.
21 22 23 24 |
# File 'lib/onstomp/connections/stomp_1_0.rb', line 21 def subscribe_frame d, h h[:ack] = 'auto' unless h[:ack] == 'client' create_frame 'SUBSCRIBE', [{:id => OnStomp.next_serial}, h, {:destination => d}] end |