I'm making a simple web push system.
Each user registers, gets a unique vapid key, puts it in his web, his web users subscribes to push notifications with the vapid key, then the user can send push notifications via push system web interface.
I need a solution to install the server key in users websites.
Should I make a some sort of a plugin/javascript sdk, for example, the user would add a script from an SDK, and then init the script with his unique vapid key from the system? Like so:
pushSystem.init({ id: vapid_key })
The script would then subscribe the user with the key and send the subscribtion to the server, where I would pull the subscribtions for this private key in the web interface and send push to all of them.
How should I go about this? I did a lot of research, didin't really find anything about this.
答案 0 :(得分:1)
At Pushpad we do this:
pushpad('init', PROJECT_ID)
PROJECT_ID
and is stored in a variablepushpad('subscribe')
, which calls pushManage.subscribe()
using the VAPID public key