1

I'm wondering if using the server-sent events described here: https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events , therefore from a web browser on desktop or mobile, once the user "subscribe" to it, gets the notification even if the browser is closed.

I imagine that the popup window that sometimes I get browsing on some sites, like the one below

enter image description here

is given by adding the server-sent events, right?

Giox
  • 4,785
  • 8
  • 38
  • 81

1 Answers1

1

I see two parts in your question:

Is the "Show notifications" popup related to server-sent events?

No.

This comes from the Notifications API.

That popup is displayed when the JavaScript application running in the browser calls Notification.requestPermission().

Will server-sent events be received by the browser when it's closed?

No.

That's not the purpose of server-sent events. SSE is a mechanism for streaming data from a server to the browser, similar to WebSockets.

How to send notifications to the user even if the browser is closed?

I'd refer you to other questions that have already been answered here:

rsmeral
  • 518
  • 3
  • 8