Sha256: bd4969e0753f2f9c66c3e91e300831ff06e63aa2a9c104c71b9190ce88570ba4

Contents?: true

Size: 1.21 KB

Versions: 1

Compression:

Stored size: 1.21 KB

Contents

module Stomper
  module Frames
    # Encapsulates a "SUBSCRIBE" frame from the Stomp Protocol.
    class Subscribe < Stomper::Frames::ClientFrame
      def initialize(destination, headers={})
        super({ :ack => 'auto' }.merge(headers).merge({ :destination => destination }))
      end

      # Returns the ack mode of this subscription. (defaults to 'auto')
      #
      # This is a convenience method, and may also be accessed through
      # frame.headers[:ack]
      def ack
        @headers[:ack]
      end

      # Returns the destination to which we are subscribing.
      #
      # This is a convenience method, and may also be accessed through
      # frame.headers[:destination]
      def destination
        @headers[:destination]
      end

      # Returns the id of this subscription, if it has been set.
      #
      # This is a convenience method, and may also be accessed through
      # frame.headers[:id]
      def id
        @headers[:id]
      end

      # Returns the selector header of this subscription, if it has been set.
      #
      # This is a convenience method, and may also be accessed through
      # frame.headers[:selector]
      def selector
        @headers[:selector]
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
stomper-1.0.0 lib/stomper/frames/subscribe.rb