webpush
packageThis package is not in the latest version of its module.
Details
Validgo.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
Links
Documentation¶
Index¶
Constants¶
This section is empty.
Variables¶
This section is empty.
Functions¶
Types¶
typeDispatcher¶
type Dispatcher interface {// Dispatch sends a web push notification to all subscriptions// for a user. Any notifications that fail to send are silently dropped.Dispatch(ctxcontext.Context, userIDuuid.UUID, notificationcodersdk.WebpushMessage)error// Test sends a test web push notificatoin to a subscription to ensure it is valid.Test(ctxcontext.Context, reqcodersdk.WebpushSubscription)error// PublicKey returns the VAPID public key for the webpush dispatcher.PublicKey()string}
Dispatcher is an interface that can be used to dispatchweb push notifications to clients such as browsers.
funcNew¶
New creates a new Dispatcher to dispatch web push notifications.
This is *not* integrated into the enqueue system unfortunately.That's because the notifications system has a enqueue system,and push notifications at time of implementation are being usedfor updates inside of a workspace, which we want to be immediate.
typeNoopWebpusher¶
type NoopWebpusher struct {Msgstring}
NoopWebpusher is a Dispatcher that does nothing except return an error.This is returned when web push notifications are disabled, or if there was anerror generating the VAPID keys.
func (*NoopWebpusher)Dispatch¶
func (n *NoopWebpusher) Dispatch(context.Context,uuid.UUID,codersdk.WebpushMessage)error
func (*NoopWebpusher)PublicKey¶
func (*NoopWebpusher) PublicKey()string
func (*NoopWebpusher)Test¶
func (n *NoopWebpusher) Test(context.Context,codersdk.WebpushSubscription)error
typeWebpusher¶
type Webpusher struct {// public and private keys for VAPID. These are used to sign and encrypt// the message payload.VAPIDPublicKeystringVAPIDPrivateKeystring// contains filtered or unexported fields}