Class: Mameapns::Session::Feedback

Inherits:
Mameapns::Session show all
Defined in:
lib/mameapns/session/feedback.rb

Constant Summary collapse

TAPLE_BYTES =
38
POLL =
60

Instance Attribute Summary

Attributes inherited from Mameapns::Session

#connection, #host, #interruptible_sleep, #port, #queue, #ssl_cert, #ssl_cert_key, #ssl_cert_pass

Instance Method Summary collapse

Methods inherited from Mameapns::Session

#close, #connect, #end_session, #handle_error, #handle_sent, #initialize, #on_error, #on_exception, #on_sent, #push, #read, #reconnect, #running?, #select, #start, #stop, #wait_stop, #write

Constructor Details

This class inherits a constructor from Mameapns::Session

Instance Method Details

#start_sessionObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/mameapns/session/feedback.rb', line 8

def start_session
  while running?
    connect
    
    while tuple = read(TAPLE_BYTES)
      timestamp, _, device_token = tuple.unpack('N1n1H*')
      handler_error(nil, DeviceNotExist.new(timestamp, device_token))
    end

    close
    
    interruptible_sleep.wait(POLL)
  end
end