htmlpush-notificationserver-sent-eventsweb-pushpush-api

What is the difference between Push API and Server Sent Events?


From the documentation I could figure out that Push API and Server Sent Events both are half duplex but why two different technologies for the same functionality? Is there something more significant in Push API?


Solution

  • The Push API allows the server to send a notification to a client even when your site is not open, because it relies on service workers.

    SSE (or WebSockets) work as long as the user is using your site.

    There are some examples (with documentation) in the Web Push section of the ServiceWorker Cookbook that can help you understand this better.