Can someone tell me if service workers (https://developers.google.com/web/fundamentals/primers/service-workers/) support server sent events (SSE)?
Check Browser Support for SSE: Before implementing the SSE, checking the support of the browser is necessary. To check the support, we'll use an if and else statement and run the following code using the EventSource object. The EventSource object is used to receive the events or notifications from the server.
Server-Sent Events (SSE) is a server push technology enabling a client to receive automatic updates from a server via an HTTP connection, and describes how servers can initiate data transmission towards clients once an initial client connection has been established.
SSE is designed to use the JavaScript EventSource API in order to subscribe to a stream of data in any popular browser. Through this interface a client requests a particular URL in order to receive an event stream. SSE is commonly used to send message updates or continuous data streams to a browser client.
Postman has proven to be an indispensable tool for working with APIs, but we keep hitting the wall when it comes to working with streaming APIs that employ Server-Sent Events (SSE). Unlike Websockets, SSE leverages HTTP to deliver API responses.
As per the service worker specification's issue tracker, service workers should be able to intercept EventSource
.
That being said, I've never seen an example of a service worker that did anything meaningful with server-sent events.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With