NAME
Net::APNS::Feedback - Retrieve data from Apple's APNS feedback service
SYNOPSIS
use Net::APNS::Feedback;
my $devicetoken_hex = '04ef31c862...0ea878416';
my $apns = Net::APNS::Feedback->new({
sandbox => 1,
cert => 'cert.pem',
key => 'key.pem',
passwd => 'key password',
});
my @feedback = $apns->retrieve_feedback;
DESCRIPTION
Apple's APNS system provides a feedback service to let you know the device rejected notifications because they are no longer wanted (usually meaning the app has been removed).
METHODS
new
Args:
- sandbox
-
set to true if you want to use the sandbox host. defaults to 0. ignored if you set the host manually
- cert
-
path to your certificate
- cert_type
-
defaults to PEM - see Net::SSLeay.
- key
-
path you your private key
- key_type
-
defaults to PEM - see Net::SSLeay.
- passwd
-
password for your private key, if required.
- host
-
defaults to feedback.push.apple.com or feedback.sandbox.push.apple.com depending on the setting of sandbox. can be set manually.
- port
-
defaults to 2196
- command
-
defaults to 0
NB: all these args are available as accessors, but you need to set them before the connection is first used.
retrieve_feedback
Takes no arguments and returns an arrayref (possibly) containing hashrefs. eg:
[
{
'time_t' => 1259577923,
'token' => '04ef31c86205...624f390ea878416'
},
{
'time_t' => 1259577926,
'token' => '04ef31c86205...624f390ea878416'
},
]
time_t
is the epoc time of when the notification was rejected. token
is a hex encoded device token for you to reconcile with your data.
As you can see from this example, you can recieve more than one notifications about the same token if you have had more than one message rejected since you last checked the feedback service.
Note that once you have drained all the feedback, you will not be delivered the same set again.
disconnect
Disconnect the ssl connection and socket, and free the ssl structures. This usually isn't necessary as this will happen implicitly when the object is destroyed.
SEE ALSO
- http://developer.apple.com/IPhone/library/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Introduction/Introduction.html
- Net::APNS::Persistent
- http://github.com/aufflick/p5-net-apns-persistent
AUTHOR
Mark Aufflick, <aufflick@local>
COPYRIGHT AND LICENSE
Copyright (C) 2009 by Mark Aufflick
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.9 or, at your option, any later version of Perl 5 you may have available.
4 POD Errors
The following errors were encountered while parsing the POD:
- Around line 45:
alternative text 'http://developer.apple.com/IPhone/library/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Introduction/Introduction.html' contains non-escaped | or /
- Around line 139:
alternative text 'http://developer.apple.com/IPhone/library/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Introduction/Introduction.html' contains non-escaped | or /
- Around line 172:
alternative text 'http://developer.apple.com/IPhone/library/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Introduction/Introduction.html' contains non-escaped | or /
- Around line 176:
alternative text 'http://github.com/aufflick/p5-net-apns-persistent' contains non-escaped | or /