Server-sent events are those events that are pushed from the web server to the browsers. These events can be used to continuously update DOM elements.
In the case of polling, since every time an HTTP connection is established and torn down, there is a lot of overhead. In server-sent events, there the HTTP connection is long-lived, which is a big advantage over polling.
To use a server-sent event, is used. This element’s SRC attribute specifies the URL from which it sends a data stream that contains the events.