Bonfire.Notify.WebPush (Bonfire v1.0.1-social-alpha.28)
View SourceManages web push subscriptions and sends notifications using ExNudge.
Summary
Functions
Broadcasts a message to ALL active subscriptions (admin/testing use). Use with caution - this sends to every subscribed user.
Helper to format a push notification message.
Fetches all subscriptions for a list of user ids. Returns a map of user_id => list of ExNudge.Subscription structs. Only returns active subscriptions.
Removes a subscription by its database ID.
Removes a subscription by endpoint.
Sends a push notification to a single subscription by database ID. Useful for testing individual subscriptions.
Sends a web push notification to all subscriptions for a user or multiple users. Uses ExNudge to handle the actual sending.
Registers a push subscription for a user.
Functions
Broadcasts a message to ALL active subscriptions (admin/testing use). Use with caution - this sends to every subscribed user.
Helper to format a push notification message.
@spec get_subscriptions([String.t()]) :: %{ optional(String.t()) => [ExNudge.Subscription.t()] }
Fetches all subscriptions for a list of user ids. Returns a map of user_id => list of ExNudge.Subscription structs. Only returns active subscriptions.
Removes a subscription by its database ID.
Removes a subscription by endpoint.
Sends a push notification to a single subscription by database ID. Useful for testing individual subscriptions.
Sends a web push notification to all subscriptions for a user or multiple users. Uses ExNudge to handle the actual sending.
@spec subscribe(String.t(), map() | String.t()) :: {:ok, Bonfire.Notify.UserSubscription.t()} | {:error, Ecto.Changeset.t() | atom()}
Registers a push subscription for a user.