queue-run
queue-run copied to clipboard
WebPush
https://developer.mozilla.org/en-US/docs/Web/API/Push_API
Conceptually should work similarly to WebSocket where you send a notification to the current user or specific user:
await webPush.send(myMessage);
await webPush.to(userId).send(myMessage);
There needs to be an API endpoint to associate subscription with a user, this could look like:
import { webPush } from 'queue-run';
export default webPush.subscription;
The client has one endpoint (of their choosing) and it can POST to that endpoint with the serialized PushSubscription object.
And if we support the expiration time, the client can unsubscribe a user by setting the expiration time to 0.