The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

Build Status

NAME

Net::Azure::NotificationHubs - A Client Class for Azure Notification Hubs

SYNOPSIS

use Net::Azure::NotificationHubs;
my $nh = Net::Azure::NotificationHubs->new(
    connection_string => 'Endpoint=sb://...',
    hub_name          => 'myhub',
    apns_expiry       => '2017-10-10T00:00+09:00',
);
## or use Net::Azure::Authorization::SAS for Authorization
my $sas = Net::Azure::Authorization::SAS->new(connection_string => 'Endpoint=sb://...');
$nh = Net::Azure::NotificationHubs->new(
    authorizer  => $sas
    hub_name    => 'myhub',
    apns_expiry => '2017-10-10T00:00+09:00',
);
## send to apple push notification service
my $payload = {aps => {alert => "Hello, Notification Hubs!"}};
my $req = $nh->send($payload, format => 'apple');
my $res = $req->do;
## send to google cloud messaging with tag specification
my $payload = {data => {message => "Hello, Notification Hubs!"}};
my $req = $nh->send($payload, format => 'gcm', tags => 'TargetId=12345');
my $res = $req->do;

DESCRIPTION

Net::Azure::NotificationHubs is a cliant class for Azure Notification Hubs.

If you want to know more information about Azure Notification Hubs, please see https://msdn.microsoft.com/en-us/library/dn223264.aspx.

METHODS

new

my $eh = Net::Azure::NotificationHubs->new(
    connection_string => 'Endpoint=sb://...',
    hub_name          => 'muhub',
    apns_expiry       => '2017-10-10T00:00+09:00',
);

A constructor method.

send

my $req = $nh->send($payload, %param);
$req->do;

Returns an object of Net::Azure::NotificationHubs::Reqest.

Send a message that contains specified payload to Azure Notification Hubs when do() method is called.

$payload is a hashref.

%param may be contains following parameters.

LICENSE

Copyright (C) ytnobody.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

AUTHOR

ytnobody ytnobody@gmail.com