push

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package push delivers Web Push notifications straight from this machine to the browsers paired with it — no third party in the middle. A VAPID keypair (generated once, kept under ~/.cuxdeck) identifies this deck to the browsers' push services; subscriptions are stored locally and keyed by device token, so revoking a device silences it. Payloads are the same small JSON the service worker renders as a notification.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event = notify.Event

Event is re-exported from notify so callers can keep using push.Event while the watcher speaks the shared type.

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store holds the VAPID keys and the live subscriptions.

func Open

func Open(dir string) (*Store, error)

Open loads (or creates) the VAPID keypair and any saved subscriptions under dir.

func (*Store) Has

func (s *Store) Has() bool

Has reports whether any subscriptions exist (so the watcher can skip work when nobody's listening).

func (*Store) Notify

func (s *Store) Notify(ev Event)

Notify sends ev to every subscription. Subscriptions the push service reports as gone (404/410) are pruned.

func (*Store) PublicKey

func (s *Store) PublicKey() string

PublicKey is handed to the browser so it can subscribe to this deck.

func (*Store) Subscribe

func (s *Store) Subscribe(device string, w *webpush.Subscription)

Subscribe records (or refreshes) a browser subscription for a device. A device replaces its own prior subscription so re-enabling doesn't pile up duplicates.

func (*Store) Unsubscribe

func (s *Store) Unsubscribe(device string)

Unsubscribe drops every subscription owned by a device (called on device revoke and on explicit disable).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL