WebPushEncryption.Push (web_push_encryption v0.3.1) View Source
Module to send web push notifications with a payload through GCM
Link to this section Summary
Functions
Sends a web push notification with a payload through GCM.
Link to this section Functions
Specs
send_web_push( message :: binary(), subscription :: map(), auth_token :: binary() | nil, ttl :: integer() ) :: {:ok, any()} | {:error, atom()}
Sends a web push notification with a payload through GCM.
Arguments
message
is a binary payload. It can be JSON encodedsubscription
is the subscription information received from the client. It should have the following form:%{keys: %{auth: AUTH, p256dh: P256DH}, endpoint: ENDPOINT}
auth_token
[Optional] is the GCM api key matching thegcm_sender_id
from the clientmanifest.json
. It is not necessary for Mozilla endpoints.ttl
[Optional] is a non-negative integer Time To Live. It is the number of seconds that a message may be stored if the user is not immediately available. Mozilla Push Service only supports a maximum TTL of 5,184,000 seconds (about one month).
Return value
Returns the result of HTTPoison.post