Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateVAPIDKeys ¶
GenerateVAPIDKeys will create a private and public VAPID key pair
func SendNotification ¶
SendNotification sends a push notification to a subscriptions endpoint Follows the Message Encryption for Web Push, and VAPID protocols
Types ¶
type HTTPClient ¶
HTTPClient is an exposed interface to pass in custom http.Client
type Options ¶
type Options struct { HTTPClient HTTPClient // Will replace with *http.Client by default if not included Subscriber string // Sub in VAPID JWT token Topic string // Set the Topic header to collapse a pending messages (Optional) TTL int // Set the TTL on the endpoint POST request Urgency Urgency // Set the Urgency header to change a message priority (Optional) VAPIDPrivateKey string // Used to sign VAPID JWT token }
Options are config and extra params needed to send a notification
type Subscription ¶
Subscription represents a PushSubscription object from the Push API
type Urgency ¶
type Urgency string
Urgency indicates to the push service how important a message is to the user. This can be used by the push service to help conserve the battery life of a user's device by only waking up for important messages when battery is low.
const ( // UrgencyVeryLow requires device state: on power and Wi-Fi UrgencyVeryLow Urgency = "very-low" // UrgencyLow requires device state: on either power or Wi-Fi UrgencyLow Urgency = "low" // UrgencyNormal excludes device state: low battery UrgencyNormal Urgency = "normal" // UrgencyHigh admits device state: low battery UrgencyHigh Urgency = "high" )
Click to show internal directories.
Click to hide internal directories.