push-notify-0.1.0.1: A server-side library for sending push notifications.

Safe HaskellNone

Network.PushNotify.Apns

Contents

Description

This library defines an API for communicating with iOS powered devices, sending Push Notifications through Apple Push Notification Service.

Synopsis

APNS Service

sendAPNS :: APNSManager -> APNSmessage -> IO APNSresultSource

sendAPNS sends the message to a APNS Server.

startAPNS :: APNSConfig -> IO APNSManagerSource

startAPNS starts the APNS service.

closeAPNS :: APNSManager -> IO ()Source

closeAPNS stops the APNS service.

withAPNS :: APNSConfig -> (APNSManager -> IO a) -> IO aSource

withAPNS creates a new manager, uses it in the provided function, and then releases it.

feedBackAPNS :: APNSConfig -> IO APNSFeedBackresultSource

feedBackAPNS connects to the Feedback service.

APNS Settings

data APNSConfig Source

APNSConfig represents the main necessary information for sending notifications through APNS.

For loading the certificate and privateKey you can use: fileReadCertificate and fileReadPrivateKey .

Constructors

APNSConfig 

Fields

apnsCertificate :: X509

Certificate provided by Apple.

apnsPrivateKey :: PrivateKey

Private key provided by Apple.

environment :: Env

One of the possible environments.

timeoutLimit :: Int

The time to wait for a server response. (microseconds)

apnsRetrySettings :: RetrySettings

How to retry to connect to APNS servers.

Instances

type DeviceToken = TextSource

Binary token stored in hexadecimal representation as text.

data Env Source

Env represents the three possible working environments. This determines the url and port to connect to.

Constructors

Development

Development environment (by Apple).

Production

Production environment (by Apple).

Local

Local environment, just to test the service in the "localhost".

Instances

APNS Messages

data APNSmessage Source

APNSmessage represents a message to be sent through APNS.

Constructors

APNSmessage 

Fields

deviceTokens :: HashSet DeviceToken

Destination.

expiry :: Maybe UTCTime

Identifies when the notification is no longer valid and can be discarded.

alert :: Either Text AlertDictionary

For the system to displays a standard alert.

badge :: Maybe Int

Number to display as the badge of the application icon.

sound :: Text

The name of a sound file in the application bundle.

rest :: Maybe Object

Extra information.

data AlertDictionary Source

AlertDictionary represents the possible dictionary in the alert label.

APNS Results

data APNSresult Source

APNSresult represents information about messages after a communication with APNS Servers.

Constructors

APNSresult 

Fields

successfulTokens :: HashSet DeviceToken
 
toReSendTokens :: HashSet DeviceToken

Failed tokens that you need to resend the message to, because there was a problem.

data APNSFeedBackresult Source

APNSFeedBackresult represents information after connecting with the Feedback service.

Constructors

APNSFeedBackresult 

Fields

unRegisteredTokens :: HashMap DeviceToken UTCTime

Devices tokens and time indicating when APNS determined that the application no longer exists on the device.