Copyright | (C) 2017 memrange UG |
---|---|
License | BSD3 |
Maintainer | Hans-Christian Esperer <hc@memrange.io> |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
Send push notifications using Apple's HTTP2 APN API
- data ApnSession
- data JsonAps
- data JsonApsAlert
- data JsonApsMessage
- data ApnMessageResult
- data ApnToken
- sendMessage :: ApnSession -> ApnToken -> JsonAps -> IO ApnMessageResult
- sendSilentMessage :: ApnSession -> ApnToken -> IO ApnMessageResult
- newSession :: FilePath -> FilePath -> FilePath -> Bool -> Int -> ByteString -> IO ApnSession
- sendRawMessage :: ApnSession -> ApnToken -> ByteString -> IO ApnMessageResult
- emptyMessage :: JsonApsMessage
- setSound :: Text -> JsonApsMessage -> JsonApsMessage
- clearSound :: JsonApsMessage -> JsonApsMessage
- setCategory :: Text -> JsonApsMessage -> JsonApsMessage
- clearCategory :: JsonApsMessage -> JsonApsMessage
- setBadge :: Int -> JsonApsMessage -> JsonApsMessage
- clearBadge :: JsonApsMessage -> JsonApsMessage
- alertMessage :: Text -> Text -> JsonApsMessage
- setAlertMessage :: Text -> Text -> JsonApsMessage -> JsonApsMessage
- clearAlertMessage :: JsonApsMessage -> JsonApsMessage
- newMessage :: JsonApsMessage -> JsonAps
- newMessageWithCustomPayload :: JsonApsMessage -> Text -> JsonAps
- hexEncodedToken :: Text -> ApnToken
- rawToken :: ByteString -> ApnToken
Documentation
data ApnSession Source #
A session that manages connections to Apple's push notification service
A push notification message
data JsonApsAlert Source #
The specification of a push notification's message body
data JsonApsMessage Source #
Push notification message's content
data ApnMessageResult Source #
The result of a send request
:: ApnSession | Session to use |
-> ApnToken | Device to send the message to |
-> JsonAps | The message to send |
-> IO ApnMessageResult |
Send a push notification message.
:: ApnSession | Session to use |
-> ApnToken | Device to send the message to |
-> IO ApnMessageResult |
Send a silent push notification
:: FilePath | Path to the client certificate key |
-> FilePath | Path to the client certificate |
-> FilePath | Path to the CA |
-> Bool | Sandbox? |
-> Int | How many messages will be sent in parallel? This corresponds to the number of http2 streams open in parallel; 100 seems to be a default value. |
-> ByteString | Topic (bundle name of the app) |
-> IO ApnSession |
Start a new session for sending APN messages. A session consists of a connection pool of connections to the APN servers, while each connection has a pool of workers that create HTTP2 streams to send individual push notifications.
:: ApnSession | Session to use |
-> ApnToken | Device to send the message to |
-> ByteString | The message to send |
-> IO ApnMessageResult |
Send a raw payload as a push notification message (advanced)
emptyMessage :: JsonApsMessage Source #
Create an empty apn message
:: Text | The sound to use (either "default" or something in the application's bundle) |
-> JsonApsMessage | The message to modify |
-> JsonApsMessage |
Set a sound for an APN message
:: JsonApsMessage | The message to modify |
-> JsonApsMessage |
Clear the sound for an APN message
:: Text | |
-> JsonApsMessage | The message to modify |
-> JsonApsMessage |
Set the category part of an APN message
:: JsonApsMessage | The message to modify |
-> JsonApsMessage |
Clear the category part of an APN message
:: Int | |
-> JsonApsMessage | The message to modify |
-> JsonApsMessage |
Set the badge part of an APN message
:: JsonApsMessage | The message to modify |
-> JsonApsMessage |
Clear the badge part of an APN message
:: Text | The title of the message |
-> Text | The body of the message |
-> JsonApsMessage |
Create a new APN message with an alert part
:: Text | The title of the message |
-> Text | The body of the message |
-> JsonApsMessage | The message to alter |
-> JsonApsMessage |
Set the alert part of an APN message
:: JsonApsMessage | The message to modify |
-> JsonApsMessage |
Remove the alert part of an APN message
:: JsonApsMessage | The standard message to include |
-> JsonAps |
Prepare a new apn message consisting of a standard message without a custom payload
newMessageWithCustomPayload Source #
:: JsonApsMessage | The message |
-> Text | The custom payload |
-> JsonAps |
Prepare a new apn message consisting of a standard message and a custom payload
Create a token from a hex encoded text
:: ByteString | The bytestring that uniquely identifies a device (APN token) |
-> ApnToken |
Create a token from a raw bytestring