Sha256: 21918e9841c02d54d398ac23ed2d7fa2fe435553b268dbd3638e054ecb3974d4

Contents?: true

Size: 772 Bytes

Versions: 8

Compression:

Stored size: 772 Bytes

Contents

# Toplevel Pubnub module.
module Pubnub
  # Holds subscribe functionality, beware, most of subscribe functionality is
  # held by SubscribeEvent
  class Subscribe < SubscribeEvent
    include Concurrent::Async
    include Pubnub::Validator::Subscribe

    def initialize(options, app)
      @event = :subscribe

      # Override crypto module if custom cipher key has been used.
      random_iv = options.key?(:random_iv) ? options[:random_iv] : true
      options[:crypto_module] = Crypto::CryptoModule.new_legacy(options[:cipher_key], random_iv) if options[:cipher_key]

      super
      app.apply_state(self)
    end

    def clear_state
      @state = nil
    end

    private

    def current_operation
      Pubnub::Constants::OPERATION_SUBSCRIBE
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
pubnub-5.5.0 lib/pubnub/events/subscribe.rb
pubnub-5.4.0 lib/pubnub/events/subscribe.rb
pubnub-5.3.5 lib/pubnub/events/subscribe.rb
pubnub-5.3.4 lib/pubnub/events/subscribe.rb
pubnub-5.3.3 lib/pubnub/events/subscribe.rb
pubnub-5.3.2 lib/pubnub/events/subscribe.rb
pubnub-5.3.1 lib/pubnub/events/subscribe.rb
pubnub-5.3.0 lib/pubnub/events/subscribe.rb