Net::APNs::HTTP2 - APNs Provider API for Perl
use Net::APNs::HTTP2; my $apns = Net::APNs::HTTP2->new( is_development => 1, auth_key => 'auth_key.p8', key_id => $key_id, team_id => $team_id, bundle_id => $bundle_id, ); while (1) { $apns->prepare($device_token, { aps => { alert => 'some message', badge => 1, }, }, sub { my ($header, $content) = @_; # $header = [ # ":status" => "200", # "apns-id" => "82B34E17-370A-DBF4-5046-FF56A4EA1FAF", # ]; ... }); # You can chain prepare statements $apns->prepare(...)->prepare(...)->prepare(...); # send all prepared requests in parallel $apns->send; # do something } # must call `close` when finished $apns->close;
Net::APNs::HTTP2 is APNs Provider API for Perl.
Create a new instance of Net::APNs::HTTP2.
Net::APNs::HTTP2
Supported arguments are:
Universal Push Notification Client SSL Certificate. This certificate filename like AuthKey_XXXXXXXXXX.p8.
A 10-character key identifier (kid) key, obtained from your developer account.
The issuer (iss) registered claim key, whose value is your 10-character Team ID, obtained from your developer account.
Your Application bundle identifier.
Development server: api.development.push.apple.com:443 Production server: api.push.apple.com:443
Create a request.
$apns->prepare($device_token, { aps => { alert => { title => 'test message', body => 'from Net::APNs::HTTP2', }, badge => 1, }, }, sub { my ($header, $content) = @_; # $header = [ # ":status" => "200", # "apns-id" => "82B34E17-370A-DBF4-5046-FF56A4EA1FAF", # ]; ... });
You can chain calls to prepare:
$apns->prepare(...)->prepare(...)->prepare(...)->send();
Send notification.
Close connections.
Callback that is invoked when there's a hard error trying to open the connection to Apple.
$fatal
A boolean which will be true if this is a fatal error.
$message
The error returned from the server.
Copyright (C) xaicron.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
xaicron <xaicron@gmail.com>
To install Net::APNs::HTTP2, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::APNs::HTTP2
CPAN shell
perl -MCPAN -e shell install Net::APNs::HTTP2
For more information on module installation, please visit the detailed CPAN module installation guide.