web_push_encryption v0.2.0 WebPushEncryption.Push 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

Link to this function send_web_push(message, subscription, auth_token \\ nil) View Source
send_web_push(
  message :: binary(),
  subscription :: map(),
  auth_token :: binary() | nil
) :: {:ok, any()} | {:error, atom()}

Sends a web push notification with a payload through GCM.

Arguments

  • message is a binary payload. It can be JSON encoded
  • subscription 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 the gcm_sender_id from the client manifest.json. It is not necessary for Mozilla endpoints.

Return value

Returns the result of HTTPoison.post