Without using service workers, how can I send web push notifications?

2k views Asked by At

Is there any way to send push notifications without using service workers ?

2

There are 2 answers

1
Marco Castelluccio On

No, in order to use the Push API, you need a Service Worker.

1
Alok Singhal On

You can use various services like Pusher/Pubnub etc. to send push notifications on your behalf. For example using Pusher and Python, you can do something like this:

from pusher import Pusher

pusher = Pusher(
  app_id=u'APP_ID',
  key=u'APP_KEY',
  secret=u'APP_SECRET'
)

pusher.trigger(u'test_channel', u'my_event', {u'message': u'hello       world'})