Documentation ¶
Index ¶
- func NewPushRequest(sub *auth.Subscription, message string, token string) (*http.Request, error)
- func NewRequest(to *auth.Subscription, message string, ttlSec int, vapid *auth.Vapid) (*http.Request, error)
- func Send(client *http.Client, sub *auth.Subscription, message, token string) (*http.Response, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewPushRequest ¶
NewPushRequest creates a valid Web Push HTTP request for sending a message to a subscriber. If the push service requires an authentication header (notably Google Cloud Messaging, used by Chrome) then you can add that as the token parameter. Deprecated - token auth is not part of the spec.
func NewRequest ¶
func NewRequest(to *auth.Subscription, message string, ttlSec int, vapid *auth.Vapid) (*http.Request, error)
NewVapidRequest creates a valid Web Push HTTP request for sending a message to a subscriber, using Vapid authentication. You can add more headers to configure collapsing, TTL.
func Send ¶
func Send(client *http.Client, sub *auth.Subscription, message, token string) (*http.Response, error)
Send a message using the Web Push protocol to the recipient identified by the given subscription object. If the client is nil then the default HTTP client will be used. If the push service requires an authentication header (notably Google Cloud Messaging, used by Chrome) then you can add that as the token parameter.
Types ¶
This section is empty.