Movatterモバイル変換


[0]ホーム

URL:


webpush

package
v2.23.0Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 3, 2025 License:AGPL-3.0Imports:16Imported by:0

Details

Repository

github.com/coder/coder

Links

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

funcRegenerateVAPIDKeys

func RegenerateVAPIDKeys(ctxcontext.Context, dbdatabase.Store) (newPrivateKeystring, newPublicKeystring, errerror)

RegenerateVAPIDKeys regenerates the VAPID keys and deletes all existingpush subscriptions as part of the transaction, as they are no longer valid.

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

func New(ctxcontext.Context, log *slog.Logger, dbdatabase.Store, vapidSubstring) (Dispatcher,error)

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.

See:https://github.com/coder/internal/issues/528

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)PublicKey

func (*NoopWebpusher) PublicKey()string

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}

func (*Webpusher)Dispatch

func (n *Webpusher) Dispatch(ctxcontext.Context, userIDuuid.UUID, msgcodersdk.WebpushMessage)error

func (*Webpusher)PublicKey

func (n *Webpusher) PublicKey()string

PublicKey returns the VAPID public key for the webpush dispatcher.Clients need this, so it's exposed via the BuildInfo endpoint.

func (*Webpusher)Test

Source Files

View all Source files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f orF : Jump to
y orY : Canonical URL
go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.Learn more.

[8]ページ先頭

©2009-2025 Movatter.jp