NAME

Net::APNS::Feedback - Retrieve data from Apple's APNS feedback service

SYNOPSIS

use Net::APNS::Feedback;

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).

See the Apple Push Notification Service Programming Guide.

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

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.

See the Apple Push Notification Service Programming Guide.

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

Presentation on this module by Author

http://mark.aufflick.com/talks/apns

Apple Push Notification Service Programming Guide

http://developer.apple.com/IPhone/library/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Introduction/Introduction.html

Net::APNS::Persistent
GIT Source Repository for this module

http://github.com/aufflick/p5-net-apns-persistent

AUTHOR

Mark Aufflick, <mark@aufflick.com>, http://mark.aufflick.com/

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.