Nickersoft / push.js

The world's most versatile desktop notifications framework :earth_americas:
https://pushjs.org
MIT License
8.76k stars 548 forks source link

Instruction on how to set up in Nuxt project #266

Closed louis-l closed 4 years ago

louis-l commented 4 years ago

Hi there,

Thanks for the awesome library. I started to look around and figure out if this is suitable for my existing Nuxt project (using PWA module).

I want to push notifications to desktop and mobile devices no matter the web app is being opened (active) or running in background (using service worker). I have read the https://pushjs.org/docs/options but still not sure how to. Also I cannot test this in local environment, so the only way for me to try and test this is to set up a staging environment, which requires a bit of work. Therefore, it would be great if you can help me to answer these questions:

Thank you.

theLufenk commented 4 years ago

Hi @louis-l Thanks for trying out the library.

It appears to me that what you intend to do is send targeted notifications to your users, possibly triggered by a server.

This library, admittedly named ambiguously, does not implement the PUSH api. Only the NOTIFICATION api.

Collecting subscribers and sending targeted push notifications would entail using a service such as Firebase.

Here is an awesome and interesting guide by google developers: https://developers.google.com/web/ilt/pwa/introduction-to-push-notifications#how_web_push_works

This should get you on the path I reckon.

Also as a suggestion, I have had pretty pleasant experience with One Signal as a platform for push notifications. You can check that out here: https://onesignal.com/

Hope it helps :)

louis-l commented 4 years ago

Thanks @theLufenk, really appriciate your helps here.

I came across OneSignal before, even through they have segments to send notifications to different users, but it requires a bit of work to sync OneSignal subscribers with our internal users in order to correctly push notifications based on our internal user IDs.

Anyway, I found https://github.com/laravel-notification-channels/webpush which seems to be the solution that Im looking for. Will try it out.

Thanks again 👍