Class: AppleShove::APNS::FeedbackConnection

Inherits:
Connection
  • Object
show all
Defined in:
lib/apple_shove/apns/feedback_connection.rb

Instance Attribute Summary

Attributes inherited from Connection

#last_used

Instance Method Summary collapse

Methods inherited from Connection

#disconnect, #reconnect, #safe_last_used, #socket

Constructor Details

#initialize(p12, sandbox) ⇒ FeedbackConnection

Returns a new instance of FeedbackConnection.



5
6
7
8
9
# File 'lib/apple_shove/apns/feedback_connection.rb', line 5

def initialize(p12, sandbox)
  host = "feedback.#{sandbox ? 'sandbox.' : ''}push.apple.com"

  super host, 2196, p12
end

Instance Method Details

#device_tokensObject



11
12
13
14
15
16
17
18
19
# File 'lib/apple_shove/apns/feedback_connection.rb', line 11

def device_tokens
  tokens = []
  while response = socket.read(38)
    timestamp, token_length, device_token = response.unpack('N1n1H*')
    tokens << device_token
  end

  tokens
end