Sha256: 9966aad95d09aa0b74e4c04118b8d6d4551468a6d1b78a806950c4bfbb355833

Contents?: true

Size: 896 Bytes

Versions: 3

Compression:

Stored size: 896 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

    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

3 entries across 3 versions & 1 rubygems

Version Path
pubnub-3.7.5 lib/pubnub/events/presence.rb
pubnub-3.7.1 lib/pubnub/events/presence.rb
pubnub-3.7.0 lib/pubnub/events/presence.rb