Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebPush for DexieCloud Feature Request #1986

Open
b-straub opened this issue May 9, 2024 · 0 comments
Open

WebPush for DexieCloud Feature Request #1986

b-straub opened this issue May 9, 2024 · 0 comments

Comments

@b-straub
Copy link

b-straub commented May 9, 2024

Since DexieCloud is now in production and running outstanding well the last missing piece for feature complete PWA apps will be support for WebPush. Given the fact that Safari for Mac and iOS does and will not support SW periodic and background sync, WebPush will be the only solution for a wide range of applications. One of the greatest benefits of using DexieCloud is getting rid of maintaining your own server, therefore an implementation of WebPush will be a natural fit.

A rough sketch could can be something like this.

  • On enable WebPush in configuration, creation of ->
    • Server only table for Vapid keys
    • Server only table for Subscriptions
    • Synced? table for notifications
  • on UserLogin and WebPush enabled, create Vapid Key pair if not exist and store on server only 'VapidTable'[User].
  • DexieCloud function to get public Vapid key (applicationServerKey) for current user
  • SW PushSubscription.subscribe(options(applicationServerKey)) -> subscription
    • store subscription in 'SubscriptionTable'[User/Subscription], the may be multiple subscriptions for same user when PWA is running on multiple devices, not sure about this…
  • Send notification ->
    • store payload in 'NotificationTable'[User] with some options: immediate, scheduled
    • Cloud server will push notification according to options to all subscriptions
    • SW handle push in the usual way
  • Unsubscribe
    • PushSubscription.getSubscription() -> subscription
    • remove subscription from 'SubscriptionTable'
    • SW PushSubscription.unsubscribe(subscription)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

1 participant