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

Safe HaskellNone




This library defines an API for communicating with Android powered devices, sending Push Notifications through Google Cloud Messaging (HTTP connection).


GCM Service

sendGCM :: Manager -> GCMHttpConfig -> GCMmessage -> IO GCMresultSource

sendGCM sends the message to a GCM Server.

GCM Settings

data GCMHttpConfig Source

GCMHttpConfig represents the main necessary information for sending notifications through GCM.




apiKey :: Text

Api key provided by Google.

numRet :: Int

Number of attemps to send the message to the server.

type RegId = TextSource

RegId is an unique identifier of an app/device, provided by GCM.

GCM Messages

data GCMmessage Source

GCMmessage represents a message to be sent through GCM. In general cases, you can use the Default value and only specify registration_ids and data_object.

On the other hand, if you want to use the rest of specific aspects, you can find more information on GCM website.

GCM Result

data GCMresult Source

GCMresult represents information about messages after a communication with GCM Servers.




multicast_id :: Maybe Integer

Unique ID (number) identifying the multicast message.

success :: Maybe Int

Number of messages that were processed without an error.

failure :: Maybe Int

Number of messages that could not be processed.

canonical_ids :: Maybe Int

Number of results that contain a canonical registration ID.

newRegids :: HashMap RegId RegId

RegIds that need to be replaced.

messagesIds :: HashMap RegId Text

Successful RegIds, and its "message_id".

errorUnRegistered :: HashSet RegId

Failed regIds that need to be removed.

errorToReSend :: HashSet RegId

Failed regIds that is necessary to resend the message to, because there was an internal problem in GCM servers.

errorRest :: HashMap RegId Text

Failed regIds with the rest of the possible errors (probably non-recoverable errors).