Module: Pubnub::SubscribeEvent::Adding

Included in:
Pubnub::SubscribeEvent
Defined in:
lib/pubnub/subscribe_event/adding.rb

Overview

Holds methods connected with channels and cg adding

Instance Method Summary collapse

Instance Method Details

#add(event) ⇒ Object



20
21
22
23
24
25
26
27
28
# File 'lib/pubnub/subscribe_event/adding.rb', line 20

def add(event)
  Pubnub.logger.debug('Pubnub') { "#{self.class}#add" }
  @app.kill_request_dispatcher(@origin, :subscribe_event)

  add_channels(event)
  add_groups(event)

  restart_heartbeat if @heart
end

#add_channels(event) ⇒ Object



13
14
15
16
17
18
# File 'lib/pubnub/subscribe_event/adding.rb', line 13

def add_channels(event)
  event.channel.each do |channel|
    add_channel channel
    add_c_cb channel, event.callback
  end
end

#add_groups(event) ⇒ Object



6
7
8
9
10
11
# File 'lib/pubnub/subscribe_event/adding.rb', line 6

def add_groups(event)
  event.group.each do |group|
    add_group group
    add_g_cb group, event.callback
  end
end