Sha256: 71abf560555c7c60764fb89d9b52e9a058656c33509f568339b4a6ae5f89e830

Contents?: true

Size: 769 Bytes

Versions: 8

Compression:

Stored size: 769 Bytes

Contents

module Pubnub
  class Presence
    include Pubnub::Event
    include Pubnub::SubscribeEvent
    include Pubnub::Formatter
    include Pubnub::Validator


    def initialize(options, app)
      super
      @channel = @channel.map {|c| c + '-pnpres'}
      @event = 'presence'
      @allow_multiple_channels = true

    end

    def fire(app)
      app.update_timetoken(0)
      super
    end

    def validate!
      super

      # Check channels
      raise ArgumentError.new(:object => self, :message => 'Presence requires :channel or :channels argument') unless @channel
      raise ArgumentError.new(:object => self, :message => 'Invalid channel(s) format! Should be type of: String, Symbol, or Array of both') unless valid_channel?

    end

    private


  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
pubnub-3.5.14 lib/pubnub/events/presence.rb
pubnub-3.5.12 lib/pubnub/events/presence.rb
pubnub-3.5.8 lib/pubnub/events/presence.rb
pubnub-3.5.7 lib/pubnub/events/presence.rb
pubnub-3.5.6 lib/pubnub/events/presence.rb
pubnub-3.5.5 lib/pubnub/events/presence.rb
pubnub-3.5.3 lib/pubnub/events/presence.rb
pubnub-3.5.1 lib/pubnub/events/presence.rb