Class: Rapns::Daemon::DeliveryHandler

Inherits:
Object
  • Object
show all
Includes:
Reflectable
Defined in:
lib/rapns/daemon/delivery_handler.rb

Direct Known Subclasses

Apns::DeliveryHandler, Gcm::DeliveryHandler

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Reflectable

#reflect

Instance Attribute Details

#queueObject

Returns the value of attribute queue.



6
7
8
# File 'lib/rapns/daemon/delivery_handler.rb', line 6

def queue
  @queue
end

Instance Method Details

#startObject



8
9
10
11
12
13
14
15
# File 'lib/rapns/daemon/delivery_handler.rb', line 8

def start
  @thread = Thread.new do
    loop do
      handle_next_notification
      break if @stop
    end
  end
end

#stopObject



17
18
19
20
21
22
23
24
# File 'lib/rapns/daemon/delivery_handler.rb', line 17

def stop
  @stop = true
  if @thread
    queue.wakeup(@thread)
    @thread.join
  end
  stopped
end