Sha256: 26fc7bc26edd40da783e02250a53f5d8d805213147f8709e8e771cae742930f8

Contents?: true

Size: 748 Bytes

Versions: 35

Compression:

Stored size: 748 Bytes

Contents

# Toplevel Pubnub module.
module Pubnub
  class SubscribeEvent < Event
    # Holds SubscribeEvent functionality connected with heartbeat
    module Heartbeat
      private

      def restart_heartbeat
        stop_heartbeat
        consider_heartbeat
      end

      def stop_heartbeat
        Pubnub.logger.debug('Pubnub') { "#{self.class}#stop_heartbeat" }

        Concurrent::Actor.kill(@heart) if @heart
        @heart = nil
      end

      def consider_heartbeat
        return unless @heartbeat && !@http_sync && !@heart

        Pubnub.logger.debug('Pubnub') { "#{self.class}#fire_heartbeat" }

        @heart = Heart.new(app: @app, heartbeat: @heartbeat, channel: @channel)
        @heart.async.start_beating
      end
    end
  end
end

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
pubnub-5.3.5 lib/pubnub/subscribe_event/heartbeat.rb
pubnub-5.3.4 lib/pubnub/subscribe_event/heartbeat.rb
pubnub-5.3.3 lib/pubnub/subscribe_event/heartbeat.rb
pubnub-5.3.2 lib/pubnub/subscribe_event/heartbeat.rb
pubnub-5.3.1 lib/pubnub/subscribe_event/heartbeat.rb
pubnub-5.3.0 lib/pubnub/subscribe_event/heartbeat.rb
pubnub-5.2.2 lib/pubnub/subscribe_event/heartbeat.rb
pubnub-5.2.1 lib/pubnub/subscribe_event/heartbeat.rb
pubnub-5.2.0 lib/pubnub/subscribe_event/heartbeat.rb
pubnub-5.1.2 lib/pubnub/subscribe_event/heartbeat.rb
pubnub-5.1.1 lib/pubnub/subscribe_event/heartbeat.rb
pubnub-5.1.0 lib/pubnub/subscribe_event/heartbeat.rb
pubnub-5.0.0 lib/pubnub/subscribe_event/heartbeat.rb
pubnub-4.8.0 lib/pubnub/subscribe_event/heartbeat.rb
pubnub-4.7.1 lib/pubnub/subscribe_event/heartbeat.rb
pubnub-4.7.0 lib/pubnub/subscribe_event/heartbeat.rb
pubnub-4.6.2 lib/pubnub/subscribe_event/heartbeat.rb
pubnub-4.6.1 lib/pubnub/subscribe_event/heartbeat.rb
pubnub-4.6.0 lib/pubnub/subscribe_event/heartbeat.rb
pubnub-4.5.0 lib/pubnub/subscribe_event/heartbeat.rb