lib/onstomp/client.rb in onstomp-1.0.0 vs lib/onstomp/client.rb in onstomp-1.0.1

- old
+ new

@@ -8,11 +8,11 @@ include OnStomp::Interfaces::ClientEvents include OnStomp::Interfaces::ReceiptManager include OnStomp::Interfaces::SubscriptionManager include OnStomp::Components::Scopes - # The +URI+ reference to the STOMP broker + # The `URI` reference to the STOMP broker # @return [String] attr_reader :uri # SSL options for the connection # @return {Symbol => Object} attr_reader :ssl @@ -45,10 +45,11 @@ # The class to use when instantiating a new IO processor for the connection. # Defaults to {OnStomp::Components::ThreadedProcessor} # @return [Class] attr_configurable_processor :processor + # @api gem:1 STOMP:1.0,1.1 # Creates a new client for the specified uri and optional hash of options. # @param [String,URI] uri # @param [{Symbol => Object}] options def initialize uri, options={} @uri = uri.is_a?(::URI) ? uri : ::URI.parse(uri) @@ -59,10 +60,11 @@ on_disconnect do |f, con| close unless f[:receipt] end end + # @api gem:1 STOMP:1.0,1.1 # Connects to the STOMP broker referenced by {#uri}. Includes optional # headers in the CONNECT frame, if specified. # @param [{#to_sym => #to_s}] headers # @return [self] def connect headers={} @@ -73,10 +75,11 @@ processor_inst.start self end alias :open :connect + # @api gem:1 STOMP:1.0,1.1 # Sends a DISCONNECT frame to the broker and blocks until the connection # has been closed. This method ensures that all frames not yet sent to # the broker will get processed barring any IO exceptions. # @param [{#to_sym => #to_s}] headers # @return [OnStomp::Components::Frame] transmitted DISCONNECT frame @@ -87,15 +90,17 @@ end end alias :disconnect_without_flush :disconnect alias :disconnect :disconnect_with_flush + # @api gem:1 STOMP:1.0,1.1 # Returns true if a connection to the broker exists and itself is connected. # @return [true,false] def connected? connection && connection.connected? end + # @api gem:1 STOMP:1.0,1.1 # Forces the connection between broker and client closed. # @note Use of this method may result in frames never being sent to the # broker. This method should only be used if {#disconnect} is not an # option and the connection needs to be terminated immediately. # @return [self]