Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func StartDeliverySubscriber ¶ added in v1.16.0
func StartDeliverySubscriber(ctx context.Context, bus *events.EventBus, notifiers []Notifier) <-chan struct{}
StartDeliverySubscriber subscribes to the EventBus and fans push notifications out to all provided Notifiers. It exits when ctx is cancelled. A single failing Notifier does not prevent delivery to the others. The returned channel is closed when the subscriber goroutine has fully exited.
func StartPushSubscriber ¶
func StartPushSubscriber(ctx context.Context, bus *events.EventBus, pushService *services.PushService)
StartPushSubscriber is the legacy entry-point. New code should use StartDeliverySubscriber with an explicit []Notifier slice.
Types ¶
type DeliveryNotification ¶ added in v1.16.0
type DeliveryNotification struct {
Title string
Body string
Icon string
Tag string
Data map[string]interface{}
RequireInteraction bool
Renotify bool
}
DeliveryNotification is the normalized notification payload passed to Notifier.Send.
type Notifier ¶ added in v1.16.0
type Notifier interface {
// Send delivers a notification. Returns nil on success.
Send(ctx context.Context, n DeliveryNotification) error
// Name returns a short identifier used in log messages.
Name() string
}
Notifier is the delivery backend interface (web push, future: email, Slack, etc.). All implementations must be safe for concurrent use.
type WebPushNotifier ¶ added in v1.16.0
type WebPushNotifier struct {
// contains filtered or unexported fields
}
WebPushNotifier delivers notifications via the Web Push protocol.
func NewWebPushNotifier ¶ added in v1.16.0
func NewWebPushNotifier(svc *services.PushService) *WebPushNotifier
NewWebPushNotifier creates a WebPushNotifier backed by the provided PushService.
func (*WebPushNotifier) Name ¶ added in v1.16.0
func (n *WebPushNotifier) Name() string
func (*WebPushNotifier) Send ¶ added in v1.16.0
func (n *WebPushNotifier) Send(_ context.Context, dn DeliveryNotification) error