if exists $payload->{aps}{badge};
# trim alert body
my $json = $self->json->encode($payload);
while (bytes::length($json) > $self->{max_payload_size}) {
if (ref $payload->{aps}{a
}
$json = $self->json->encode($payload);
}
my $command = $self->command;
if ($command == 0) {
$chunk = CORE::pack('C n/a* n/a*', $command, $device_token, $json);
}
('C L N n/a* n/a*',
$command, $extra->{identifier}, $extra->{expiry}, $device_token, $json,
);
}
else {
croak "command($command) not support. shuled be 0 or 1";
ct;
use warnings;
use 5.008_001;
our $VERSION = '0.14';
use parent 'Class::Accessor::Lite';
use JSON::XS;
use Carp qw(croak);
use File::Temp qw(tempfile);
use Socket qw(PF_INET SOCK_STREAM MSG_DONTW
e
cert
cert_type
key_file
key
key_type
read_timeout
write_timeout
json
]);
my %default = (
cert_type => Net::SSLeay::FILETYPE_PEM(),
key_type => Net::
gs();
Net::SSLeay::SSLeay_add_ssl_algorithms();
Net::SSLeay::randomize();
$args{json} ||= JSON::XS->new->utf8;
bless { %default, %args }, $class;
}
sub hostname {
my $self = shif