Module: OnStomp::Connections
- Defined in:
- lib/onstomp/connections.rb,
lib/onstomp/connections.rb
Overview
Namespace for protocol specific connections used to communicate with STOMP brokers.
Defined Under Namespace
Modules: Heartbeating, Serializers, Stomp_1 Classes: Base, Stomp_1_0, Stomp_1_1
Constant Summary collapse
- DEFAULT_SSL_OPTIONS =
Default SSL options to use when establishing an SSL connection.
{ :verify_mode => OpenSSL::SSL::VERIFY_PEER | OpenSSL::SSL::VERIFY_FAIL_IF_NO_PEER_CERT, :ca_file => nil, :ca_path => nil, :cert => nil, :key => nil, :post_connection_check => true }
- PROTOCOL_VERSIONS =
A mapping of protocol versions to the connection classes that support them.
{ '1.0' => OnStomp::Connections::Stomp_1_0, '1.1' => OnStomp::Connections::Stomp_1_1 }
Class Method Summary collapse
-
.connect(client, u_head, c_head, con_cbs) ⇒ OnStomp::Connections::Base
Creates an initial connection to the client’s broker uri, performs the CONNECT/CONNECTED frame exchange, and returns a connection suitable for the negotiated STOMP protocol version.
-
.select_supported(vers) ⇒ Array<String>
Filters a list of supplied versions to only those that are supported.
-
.supported ⇒ Array<String>
Returns a list of supported protocol versions.
Class Method Details
.connect(client, u_head, c_head, con_cbs) ⇒ OnStomp::Connections::Base
Creates an initial connection to the client’s broker uri, performs the CONNECT/CONNECTED frame exchange, and returns a connection suitable for the negotiated STOMP protocol version.
47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/onstomp/connections.rb', line 47 def self.connect client, u_head, c_head, con_cbs init_con = create_connection('1.0', nil, client) ver, connected = init_con.connect client, u_head, c_head begin negotiate_connection(ver, init_con, client).tap do |final_con| final_con.configure connected, con_cbs end rescue OnStomp::OnStompError # Perform a blocking close. init_con.close true raise end end |
.select_supported(vers) ⇒ Array<String>
Filters a list of supplied versions to only those that are supported. Results are in the same order as they are found in supported. If none of the supplied versions are supported, an empty list is returned.
29 30 31 32 |
# File 'lib/onstomp/connections.rb', line 29 def self.select_supported vers vers = Array(vers) supported.select { |v| vers.include? v } end |
.supported ⇒ Array<String>
Returns a list of supported protocol versions
19 20 21 |
# File 'lib/onstomp/connections.rb', line 19 def self.supported PROTOCOL_VERSIONS.keys.sort end |