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

Safe HaskellNone

Network.PushNotify.Mpns

Contents

Description

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

Synopsis

MPNS Service

sendMPNS :: Manager -> MPNSConfig -> MPNSmessage -> IO MPNSresultSource

sendMPNS sends the message to a MPNS Server.

MPNS Settings

data MPNSConfig Source

MPNSConfig represents the main necessary information for sending notifications through MPNS. If it is not necessary a secure connection, the default value can be used.

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

Constructors

MPNSConfig 

Fields

numRet :: Int

Number of attemps to send the message to the server.

useSecure :: Bool

To set a secure connection (HTTPS).

mpnsCertificate :: X509

Certificate (only necessary for secure connections).

mpnsPrivatekey :: PrivateKey

Private key (only necessary for secure connections).

type DeviceURI = TextSource

DeviceURI is an unique identifier of an app/device, provided by MPNS.

MPNS Messages

data MPNSType Source

MPNSType represents the three different kind of notifications.

Constructors

Toast 
Raw 
Tile 

Instances

data MPNSInterval Source

MPNSType represents the batching interval.

Constructors

Immediate

Immediate delivery.

Sec450

Delivered within 450 seconds.

Sec900

Delivered within 900 seconds.

Instances

data MPNSmessage Source

MPNSmessage represents a message to be sent through MPNS.

Constructors

MPNSmessage 

Fields

deviceURIs :: HashSet DeviceURI

Destination.

batching_interval :: MPNSInterval

When to deliver the notification.

target :: MPNSType

The kind of notification.

restXML :: Document

The XML data content to be sent.

MPNS Result

data MPNSresult Source

MPNSresult represents information about messages after a communication with MPNS Servers.

Take into account that a successful result after communicating with MPNS servers does not mean that the notification was successfully sent. It is necessary to check the MPNSinfo , provided by the servers, to really know about the state of the notification.

Constructors

MPNSresult 

Fields

successfullResults :: HashMap DeviceURI MPNSinfo

Notifications that were successfully sent. (To the server, not to device)

errorException :: HashMap DeviceURI SomeException

Failed notifications that you need to resend, because there was a problem connecting with MPNS servers.

Instances

data MPNSinfo Source

MPNSinfo represents information about a specific notification and device, after a communication with MPNS Servers.

Instances

data MPNSnotifStatus Source

MPNSnotifStatus represents the status of a notification which has been sent.

data MPNSsubStatus Source

MPNSsubStatus represents the status of a subscription.

Constructors

Active 
Expired 

data MPNSconStatus Source

MPNSconStatus represents the status of a connection.