push-notify-ccs-0.1.0.0: A server-side library for sending/receiving push notifications through CCS (Google Cloud Messaging).

Safe HaskellNone

Network.PushNotify.Ccs

Contents

Description

This library defines an API for communicating with Android powered devices, sending Push Notifications through Cloud Connection Server (GCM).

The GCM Cloud Connection Server (CCS) is a connection server based on XMPP.

CCS allows 3rd-party app servers to communicate with Android devices by establishing a persistent TCP connection with Google servers using the XMPP protocol. This communication is asynchronous and bidirectional.

To establish a XMPP connection, this library uses Pontarius XMPP library.

Synopsis

CCS Service

startCCSSource

Arguments

:: GCMCcsConfig

The main configuration for the GCM service.

-> (RegId -> Value -> IO ())

A callback function to be called each time a message arrives from a device.

-> IO CCSManager 

startCCS starts the CCS service, which means starting a worker thread which maintains a connection with CCS servers.

closeCCS :: CCSManager -> IO ()Source

closeCCS stops the CCS service.

This means stopping the worker thread which maintains a connection with CCS servers.

sendCCS :: CCSManager -> GCMmessage -> IO GCMresultSource

sendCCS sends messages to a CCS Server.

Every time you call this function, it will put the notification in a channel waiting to be proceesed by the worker thread.

It will block until the worker thread receives a response from CCS server.

CCS Settings

data GCMCcsConfig Source

GCMCcsConfig represents the main necessary information for sending notifications through CCS.

Constructors

GCMCcsConfig 

Fields

aPiKey :: Text

Api key provided by Google.

senderID :: Text

Sender ID provided by Google.

ccsRetrySettings :: RetrySettings

How to retry to connect to CCS servers.

CCS Utilities

withCCS :: GCMCcsConfig -> (RegId -> Value -> IO ()) -> (CCSManager -> IO a) -> IO aSource

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

(The second argument is a callback function to be called each time a message arrives from a device).

withCCS' :: GCMCcsConfig -> (CCSManager -> IO a) -> IO aSource

withCCS' creates a new manager, uses it in the provided function, and then releases it (ignores messages that arrive from a device).

data CCSManager Source

Manager of a CCS Connection.