Documentation
¶
Overview ¶
Package webpush is the Web Push wire adapter: VAPID key generation, RFC 8291 payload encryption with RFC 8292 VAPID authorization, and classification of push service responses. It holds no storage or diffx policy.
Index ¶
Constants ¶
const ( UrgencyVeryLow = "very-low" UrgencyLow = "low" UrgencyNormal = "normal" UrgencyHigh = "high" )
Urgency values defined by RFC 8030.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
type Keys ¶
Keys is a VAPID key pair: the base64url uncompressed P-256 public point browsers use as applicationServerKey, and the base64url private scalar.
type Option ¶
type Option func(*Client)
func WithHTTPClient ¶
WithHTTPClient replaces the default client, which times out after 30 seconds.
type Options ¶
Options are the RFC 8030 message headers. Topic replaces an undelivered message with the same topic; it must be at most 32 base64url characters.
type Outcome ¶
type Outcome int
Outcome classifies a push service response.
const ( // Accepted: the push service took the message (2xx). Accepted Outcome = iota // Gone: the subscription expired or was unsubscribed (404, 410). Gone // Retry: rate limited, a server failure or a network error (429, 5xx). Retry // Permanent: the push service refused this message (other 4xx, including 413). Permanent )
type Result ¶
Result is a classified send. RetryAfter carries the push service's Retry-After when it gave one; Status is zero without a response.
type Subscription ¶
Subscription is a browser PushSubscription: its endpoint and base64url keys.