| Safe Haskell | None |
|---|
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.
- startCCS :: GCMCcsConfig -> (RegId -> Value -> IO ()) -> IO CCSManager
- closeCCS :: CCSManager -> IO ()
- sendCCS :: CCSManager -> GCMmessage -> IO GCMresult
- data GCMCcsConfig = GCMCcsConfig {}
- withCCS :: GCMCcsConfig -> (RegId -> Value -> IO ()) -> (CCSManager -> IO a) -> IO a
- withCCS' :: GCMCcsConfig -> (CCSManager -> IO a) -> IO a
- data CCSManager
- module Network.PushNotify.Gcm.Types
CCS Service
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
| |
Instances
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.
module Network.PushNotify.Gcm.Types