repositorypackage
0.0.0-20220705012934-835ec7334dec
Repository: https://github.com/pnelson/webpush.git
Documentation: pkg.go.dev
# Packages
No description provided by the author
# README
webpush
Package webpush implements the Web Push protocol.
Usage
c, err := webpush.New(priv, "mailto:[email protected]")
if err != nil {
log.Fatal(err)
}
s := &webpush.Subscription{
Endpoint: "https://example.com",
PublicKey: webpush.DecodeKey(p256dh),
PrivateKey: webpush.DecodeKey(auth),
}
resp, err := c.Push(s, []byte("hello, world"), webpush.WithTTL(0))
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()