Sha256: 86d6ed63a49906cbd7687b42b1b8c78e3827f6410de19fde00a823bca8578a4b

Contents?: true

Size: 1000 Bytes

Versions: 5

Compression:

Stored size: 1000 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'}
      @channel_group = @channel_group.map {|c| c + '-pnpres'}
      @event = 'presence'
      @allow_multiple_channels = true
      @wildcard_channel = @channel.select{ |e| e.index('.*') } || []
      @channel -= @wildcard_channel
    end

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

    def validate!
      super

      # Check channels
      # raise ArgumentError.new(:object => self, :message => 'Presence requires :channel, :channels or :channel_group argument')               unless @channel || @channel_group
      # 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

5 entries across 5 versions & 1 rubygems

Version Path
pubnub-3.7.12 lib/pubnub/events/presence.rb
pubnub-3.7.11 lib/pubnub/events/presence.rb
pubnub-3.7.10 lib/pubnub/events/presence.rb
pubnub-3.7.9 lib/pubnub/events/presence.rb
pubnub-3.7.7 lib/pubnub/events/presence.rb